【发布时间】:2020-06-24 21:12:33
【问题描述】:
我正在使用 Kentico V10,我可以在本地运行网站。但是,当我尝试从控制台应用程序使用 API 时,出现以下错误。
{"Object type 'cms.class' not found."}
stackTrace 调用了检查许可证。我正在关注此页面,它说您必须为您的域添加许可证,但是当您从控制台应用程序运行时使用的是哪个域?
https://docs.kentico.com/k10/integrating-3rd-party-systems/using-the-kentico-api-externally
我正在使用来自此页面的代码。 https://docs.kentico.com/k10/managing-users/user-registration-and-authentication/configuring-single-sign-on
CMS.DataEngine.CMSApplication.Init();
string userName = "myuser";
// Gets the user with the specified user name
UserInfo userInfo = UserInfoProvider.GetUserInfo(userName);
// Gets the authentication URL for a specified user and target URL
string url = AuthenticationHelper.GetUserAuthenticationUrl(userInfo, "SecuredSurvey");
如果可以通过 REST API 获得,我很乐意以这种方式获取 URL,但据我所知,它不可用。
-兰迪
【问题讨论】:
-
这不是许可例外。相反,您的设置中似乎缺少某些东西。您的连接字符串设置正确吗?你是否安装了依赖 NuGet 包,它是否在正确的位置?
-
谢谢。原来它是 app.config 中的东西。我将整个 web.config 粘贴到 app.config 中。我从一个空白配置重新开始,只在连接字符串中添加它并且它工作。感谢您的反馈,我只是需要有人告诉我我应该工作。
标签: kentico kentico-api