2
我想在我的WCF服務(使用net.tcp綁定)託管在IIS 7中使用模擬。我已經到了它模擬客戶端,但每當我嘗試使用Settings.Default.SomeSetting訪問web.config中的任何配置設置時,都會引發SettingsPropertyNotFoundException。 這是因爲IIS在模擬身份下的身份不同?如果有,我必須更改哪些設置以允許它們在相同的模擬身份下運行? 我試過設置「servicePrincipalName」屬性沒有任何成功。訪問web.config設置使用WCF模擬與net.tcp綁定
以下附上我的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>