【发布时间】:2010-01-11 00:20:06
【问题描述】:
我正在尝试对托管在 IIS 7 中的 WCF 服务(使用 net.tcp 绑定)使用模拟。我已经到了模拟客户端的地步,但每当我尝试访问 Web 中的任何配置设置时.config 使用 Settings.Default.SomeSetting 它会引发 SettingsPropertyNotFoundException。 这是因为 IIS 在与模拟身份不同的身份下运行吗?如果是这样,我必须更改哪些设置才能让它们在相同的模拟身份下运行? 我尝试设置“servicePrincipalName”属性但没有成功。
我在下面包含了我的 web.config 设置:
<system.serviceModel>
<services>
<service name="TestServices">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="tcpbinding"
contract="Test.ITestService">
<identity>
<servicePrincipalName value="NT AUTHORITY\NETWORK SERVICE" />
</identity>
</endpoint>
<endpoint address="mextcp" binding="mexTcpBinding" contract="IMetadataExchange" />
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<bindings>
<netTcpBinding>
<binding name="tcpbinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferPoolSize="2147483647" portSharingEnabled="true">
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="None"/>
<message clientCredentialType="Windows"/>
</security>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceAuthorization impersonateCallerForAllOperations="true" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
【问题讨论】:
标签: .net wcf wcf-binding wcf-security impersonation