Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.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
WCF:无法满足安全令牌的请求,因为身份验证失败_Wcf_Wcf Binding_Wcf Security_Dotnetopenauth - Fatal编程技术网

WCF:无法满足安全令牌的请求,因为身份验证失败

WCF:无法满足安全令牌的请求,因为身份验证失败,wcf,wcf-binding,wcf-security,dotnetopenauth,Wcf,Wcf Binding,Wcf Security,Dotnetopenauth,我正在开发一个WCF服务,该服务由Oauth通过DotnetOpenAuth进行保护 在某个地方,我遇到了一个配置错误,导致了错误“由于身份验证失败,安全令牌的请求无法满足”。在我的代码中,我找不到有效的设置 localhost对localhost运行良好,但一旦我将其放在服务器上(而不是域上),它就会从该服务器到自身或从localhost到服务器失败 我有点担心这个网站上的其他一些解决方案,因为它们似乎禁用了安全性。主要是他们似乎不为我工作 提供者: <system.service

我正在开发一个WCF服务,该服务由Oauth通过DotnetOpenAuth进行保护

在某个地方,我遇到了一个配置错误,导致了错误“由于身份验证失败,安全令牌的请求无法满足”。在我的代码中,我找不到有效的设置

localhost对localhost运行良好,但一旦我将其放在服务器上(而不是域上),它就会从该服务器到自身或从localhost到服务器失败

我有点担心这个网站上的其他一些解决方案,因为它们似乎禁用了安全性。主要是他们似乎不为我工作

提供者:

   <system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name="DataApiBehavior">
                <serviceMetadata httpGetEnabled="true" />
                <serviceDebug includeExceptionDetailInFaults="true" />
                <serviceAuthorization serviceAuthorizationManagerType="OAuthServiceProvider.Code.OAuthAuthorizationManager, OAuthServiceProvider" principalPermissionMode="Custom" />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <services>
        <service behaviorConfiguration="DataApiBehavior" name="OAuthServiceProvider.DataApi">
            <endpoint address="" binding="wsHttpBinding" contract="OAuthServiceProvider.Code.IDataApi">
                <identity>
                    <dns value="localhost" />
                </identity>
            </endpoint>
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        </service>
    </services>
    <serviceHostingEnvironment>
        <baseAddressPrefixFilters>
            <add prefix="http://devel.nanaimo.ca/" />
        </baseAddressPrefixFilters>
    </serviceHostingEnvironment>
</system.serviceModel>

消费者:

<system.serviceModel>
    <bindings>
        <wsHttpBinding>
            <binding name="WSHttpBinding_IDataApi" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                allowCookies="false">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <reliableSession ordered="true" inactivityTimeout="00:10:00"
                    enabled="false" />
                <security mode="Message">
                    <transport clientCredentialType="Windows" proxyCredentialType="None"
                        realm="" />
                    <message clientCredentialType="Windows" negotiateServiceCredential="true"
                        algorithmSuite="Default" />
                </security>
            </binding>
        </wsHttpBinding>
    </bindings>
    <client>
        <endpoint address="http://devel.nanaimo.ca/NanaimoProfile/DataApi.svc"
            binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IDataApi"
            contract="CodeServiceOauthProvider.IDataApi" name="WSHttpBinding_IDataApi">
            <identity>
                <dns value="localhost" />
            </identity>
        </endpoint>
    </client>
</system.serviceModel>


更新:看起来好像没有在live上调用OAuthServiceProvider.Code.OAuthAuthorizationManager。它已实例化,但从未调用CheckAccessCore。我还不知道为什么。

这只是瞎猜,但是
授权管理器
用于授权用户,在身份验证后调用它,但您的服务配置为默认的
WsHttpBinding
-它使用消息安全性和Windows身份验证。Windows身份验证在不属于同一域的计算机之间不起作用


我将从默认为无安全性(无身份验证)的
basichttppbinding
开始。如果它能工作,那么你可以考虑你期望什么样的安全性。

我最终只创建了一个权限很小的windows用户名和密码,并将用户名硬编码到我的库中。认证本可以是另一个答案,但我从未让他们工作过