Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Tridion 2011核心服务:无法在SSO环境中连接_C#_Wcf_Web Services_Wcf Binding_Tridion - Fatal编程技术网

C# Tridion 2011核心服务:无法在SSO环境中连接

C# Tridion 2011核心服务:无法在SSO环境中连接,c#,wcf,web-services,wcf-binding,tridion,C#,Wcf,Web Services,Wcf Binding,Tridion,尝试连接到核心服务时,出现以下错误: 客户端身份验证方案“匿名”禁止HTTP请求 Tridion环境通过SiteMinder的SSO进行配置 这是我的密码: public static ICoreService2010 GetTridionClient() { var binding = new BasicHttpBinding() { Name = "BasicHttpBinding_TridionCoreService", CloseTimeo

尝试连接到核心服务时,出现以下错误:

客户端身份验证方案“匿名”禁止HTTP请求

Tridion环境通过SiteMinder的SSO进行配置

这是我的密码:

public static ICoreService2010 GetTridionClient()
{
    var binding = new BasicHttpBinding()
    {
        Name = "BasicHttpBinding_TridionCoreService",
        CloseTimeout = new TimeSpan(0, 1, 0),
        OpenTimeout = new TimeSpan(0, 1, 0),
        ReceiveTimeout = new TimeSpan(0, 10, 0),
        SendTimeout = new TimeSpan(0, 1, 0),
        AllowCookies = false,
        BypassProxyOnLocal = false,
        HostNameComparisonMode = HostNameComparisonMode.StrongWildcard,
        MaxBufferSize = 4194304, // 4MB
        MaxBufferPoolSize = 4194304,
        MaxReceivedMessageSize = 4194304,
        MessageEncoding = WSMessageEncoding.Text,
        TextEncoding = System.Text.Encoding.UTF8,
        TransferMode = TransferMode.Buffered,
        UseDefaultWebProxy = true,
        ReaderQuotas = new System.Xml.XmlDictionaryReaderQuotas()
        {
            MaxDepth = 32,
            MaxStringContentLength = 4194304, // 4MB
            MaxArrayLength = 4194304,
            MaxBytesPerRead = 4194304,
            MaxNameTableCharCount = 16384
        },
        Security = new BasicHttpSecurity()
        {
            Mode = BasicHttpSecurityMode.TransportCredentialOnly,
            Transport = new HttpTransportSecurity()
            {
                ClientCredentialType = HttpClientCredentialType.None,
            },
            Message = new BasicHttpMessageSecurity()
            {
                ClientCredentialType = BasicHttpMessageCredentialType.UserName
            }
        }
    };

    string hostname = ConfigurationManager.AppSettings["TridionUrl"];
    string username = ConfigurationManager.AppSettings["TridionUsername"];

    hostname = string.Format("{0}{1}{2}", 
                              hostname.StartsWith("http") ? "" : "http://",
                              hostname, 
                              hostname.EndsWith("/") ? "" : "/");
    var endpoint = new EndpointAddress(hostname +
                              "/webservices/CoreService.svc/basicHttp_2010");
    var factory = new ChannelFactory<ICoreService2010>(binding, endpoint);
    factory.Credentials.UserName.UserName = username;

    return factory.CreateChannel();
}
publicstaticicoservice2010 GetTridionClient()
{
var binding=new BasicHttpBinding()
{
Name=“BasicHttpBinding\u TridionCoreService”,
CloseTimeout=新的时间跨度(0,1,0),
OpenTimeout=新的时间跨度(0,1,0),
ReceiveTimeout=新的时间跨度(0,10,0),
SendTimeout=新的时间跨度(0,1,0),
AllowCookies=false,
旁路ProxyOnLocal=false,
HostNameComparisonMode=HostNameComparisonMode.strong通配符,
MaxBufferSize=4194304,//4MB
MaxBufferPoolSize=4194304,
MaxReceivedMessageSize=4194304,
MessageEncoding=WSMessageEncoding.Text,
TextEncoding=System.Text.Encoding.UTF8,
TransferMode=TransferMode.Buffered,
UseDefaultWebProxy=true,
ReaderQuotas=new System.Xml.XmlDictionaryReaderQuotas()
{
MaxDepth=32,
MaxStringContentLength=4194304,//4MB
MaxArrayLength=4194304,
MaxBytesPerRead=4194304,
MaxNameTableCharCount=16384
},
Security=new BasicHttpSecurity()
{
Mode=BasicHttpSecurityMode.TransportCredentialOnly,
传输=新的HttpTransportSecurity()
{
ClientCredentialType=HttpClientCredentialType.None,
},
Message=new BasicHttpMessageSecurity()
{
ClientCredentialType=BasicHttpMessageCredentialType.UserName
}
}
};
字符串hostname=ConfigurationManager.AppSettings[“TridionUrl”];
字符串用户名=ConfigurationManager.AppSettings[“TridionUsername”];
hostname=string.Format(“{0}{1}{2}”,
hostname.StartsWith(“http”)?:“http://”,
主机名,
hostname.EndsWith(“/”):“/”;
var endpoint=新的端点地址(主机名+
“/webservices/CoreService.svc/basicHttp_2010”);
var factory=新的ChannelFactory(绑定,端点);
factory.Credentials.UserName.UserName=用户名;
返回factory.CreateChannel();
}
有没有人有过使用Windows以外的身份验证类型与核心服务交互的经验

更新:

我现在得到错误:

客户端身份验证方案“Basic”禁止HTTP请求

在绑定的/webservices/web.config中应该使用什么clientCredentialType

当我在/webservices/web.config中取消对SsoAgentHttpModule的注释时,我们在webservice上得到了一个500错误,因此SDL告诉我们将此注释掉


我认为CoreService需要此模块才能使用身份验证方案“Basic”进行身份验证?

您的代码有两个问题:

  • 您已在服务器上将Authentication设置为anonymous,并假定应在客户端上设置Authentication,但事实并非如此。您还启用了服务器上的LDAP SSO模块,该模块在启用匿名身份验证后立即生效。在客户端,它看起来像普通的基本身份验证,因此您的客户端安全代码应该如下所示:

    Security = new BasicHttpSecurity() 
        { 
            Mode = BasicHttpSecurityMode.TransportCredentialOnly, 
            Transport = new HttpTransportSecurity() 
            { 
                ClientCredentialType = HttpClientCredentialType.Basic, 
            }
        } 
    
  • 您已设置用户名,但未设置密码,因此:

    factory.Credentials.UserName.UserName = username;
    factory.Credentials.UserName.Password = password; 
    
  • 另外,请记住,在设置用户时,可能需要指定用户名限定符(默认情况下为SSO),如SSO\User


    如果您仍然有问题,这应该会让您更进一步-请用最近的异常更新您的问题。

    谢谢您的帮助,我已用我们现在得到的异常更新了问题。您好,用户978511,您有时间可以访问Tridion StackExchange提案吗?我们相信承诺分数需要不时访问,因此不包括您在“代表次数>200的用户”中。谢谢!您不需要在/webservices/web.config中取消对SsoAgentHttpModule的注释,因为您已经在根配置中取消了对它的注释,并且它是为整个网站发布的。您确定要连接到正确的(SSO url)吗?