我有一个在 Windows 2008 机器上的 IIS 7 下运行的 .Net 3.5 SP1 WCF 服务。当我尝试从在 IIS 5.0 (Windows XP) .Net 3.5 SP1 下运行的 IIS 托管 WCF 服务连接到此服务时,我收到以下错误:
令牌提供程序无法获取目标令牌:http://( WCF 服务的 URL)
我构建了一个简单的控制台应用程序,它可以使用完全相同的配置成功连接到 WCF 服务。我还在 WebDev 服务器(Visual Studio 2008 附带的 ASP.Net 服务器)下构建了一个简单的 Web 应用程序,它能够成功连接到 WCF 服务。当我在 IIS (Windows XP) 中配置一个虚拟目录以指向与 WebDev 服务器相同的目录时,我收到以下错误:
安全包中没有可用的凭据
但是,如果我将 web.config 设置为使用我的登录凭据打开模拟,它就可以正常工作。由于显而易见的原因,这不是一个好的长期解决方案。我注意到 IIS 和 WebDev 服务器之间的一个区别是每个进程在其下运行的用户。IIS 在 ASPNet 帐户下运行,WebDev 在我的帐户下运行。
这是客户端上 WCF 部分的配置:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="mexBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="200" maxConcurrentSessions="200" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<wsHttpBinding>
<binding name="FABindings" maxReceivedMessageSize="2147483647">
<readerQuotas maxStringContentLength="300000"/>
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="false" establishSecurityContext="false" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://<server url>/FinancialAggregator/v3/Services/FAService.svc"
binding="wsHttpBinding" bindingConfiguration="FABindings"
contract="ServiceReference1.IFilteredService" name="FAServiceEndpoint">
<identity>
<servicePrincipalName value="<UsernameRunningTheAppPoolOnW2k8>" />
</identity>
</endpoint>
</client>
这是服务器配置(根据要求):
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsHttpBinding" maxReceivedMessageSize="2147483647">
<security mode="Message">
<message establishSecurityContext="false" negotiateServiceCredential="false" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="mexBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceThrottling maxConcurrentCalls="200" maxConcurrentSessions="200" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="mexBehavior" name="FCSAmerica.Financial.Aggregator.Service.FilteredService">
<endpoint name="FAServiceEndpoint" address="" binding="wsHttpBinding" bindingConfiguration="wsHttpBinding" contract="FCSAmerica.Financial.Aggregator.Service.IFilteredService">
</endpoint>
</service>
</services>
关于这个错误的原因有什么想法吗?
谢谢!