【发布时间】:2011-11-10 18:53:58
【问题描述】:
所以我正在尝试配置 WCF 4 REST 应用程序以利用多个标准端点(用于帮助功能)。原因是我的托管 IIS 进程同时启用了匿名和 Windows 身份验证,并且我的 WCF 应用程序中的某些端点需要其中一个(两者都会导致异常)。
以前,我可以通过定义一些绑定来做到这一点:
<bindings>
<webHttpBinding>
<binding name="Anonymous">
<security mode="None" />
</binding>
<binding name="WindowsAuthentication">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</webHttpBinding>
</bindings>
然后像这样定义服务:
<services>
<service name="Host.SubscriberInfoHost">
<endpoint address="" binding="webHttpBinding" bindingConfiguration="WindowsAuthentication" contract="Host.ISubscriberInfoHost" />
</service>
<service name="Utilities.Instrumentation.ServiceStatus.ServiceStatusHost">
<endpoint address="" binding="webHttpBinding" bindingConfiguration="Anonymous" contract="Utilities.Instrumentation.ServiceStatus.IServiceStatusHost" />
</service>
</services>
这是我迄今为止在使用标准端点模型时尝试做的事情:
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="Host.SubscriberInfoHost" helpEnabled="true" automaticFormatSelectionEnabled="true">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</standardEndpoint>
<standardEndpoint name="Utilities.Instrumentation.ServiceStatus.IServiceStatusHost" helpEnabled="true" automaticFormatSelectionEnabled="true">
<security mode="None" />
</standardEndpoint>
</webHttpEndpoint>
</standardEndpoints>
但是,这样做会使服务感到困惑,因为我收到了:
System.InvalidOperationException: IIS specified authentication schemes 'Negotiate, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used
这正是我想要摆脱的。任何人都可以帮助我如何使用新的标准端点模型来设置这种情况吗?谢谢!
【问题讨论】:
标签: c# wcf rest windows-authentication