0

我正在使用 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,但据我所知,它不可用。

-兰迪

4

1 回答 1

0

Kentico 有一些关于如何在外部应用程序中使用 API 的很好的文档,特别是这里的控制台库。

非常值得注意的步骤是:

  1. 连接数据库;确保使用与 web.config 中相同的连接字符串
  2. 安装 Kentico.Libraries NuGet 包
  3. 在 Global.asax 文件中的应用程序中初始化 Kentico。
  4. 整天编写自定义代码。
于 2020-06-24T13:12:33.337 回答