0
我有一個使用默認安全性(Windows據我所知)正常工作的服務。但我需要啓用mi服務跨不同的域,所以我試圖爲測試目的禁用安全性。WCF將安全設置爲無失敗
這裏的原始客戶端:
客戶端的app.config
<configuration>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IMyService">
<security>
<transport clientCredentialType="Windows" />
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://me.domain.local/MyService/Service.svc"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IMyService"
contract="MyService.IMyService" name="NetTcpBinding_IMyService">
<identity>
<servicePrincipalName value="host/me.domain.local" />
</identity>
</endpoint>
</client>
</system.serviceModel>
現在,我的Windows設置這個安全標籤從到無,我需要給同樣在服務方面,但似乎我沒有這樣做
繼承人的服務的原工作的app.config
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<system.serviceModel>
<services>
<service name="MyServiceWCF.MyService">
<endpoint address="" binding="wsHttpBinding" contract="MyServiceWCF.IMyService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/MyServiceWCF/Service1/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
我嘗試添加該標籤,但它不會工作
<bindings>
<netTcpBinding>
<binding name="netTcpBindingConfig" transferMode="Buffered" maxReceivedMessageSize="5242880">
<readerQuotas maxArrayLength="5242880" />
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
編輯1:
所以我糾正了客戶端應用程序.config代碼將安全模式設置爲無。我也嘗試使用Net Tcp綁定。
<bindings>
<netTcpBinding>
<binding name="MyBinding">
<security mode="None">
</security>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://me.domain.local/MyService/Service.svc"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IMyService"
contract="GService.IMyService" name="NetTcpBinding_IMyService">
<identity>
<servicePrincipalName value="host/me.domain.local" />
</identity>
</endpoint>
</client>
現在對於服務器端我試過這個,但不會工作。我真的覺得我在這裏錯過了一個觀點。
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IMyService">
<security mode="None"/>
</binding>
</netTcpBinding>
</bindings>
<services>
<service name="MyServiceWCF.MyService">
<endpoint address="" binding="wsHttpBinding" contract="MyServiceWCF.IMyService" >
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<endpoint address="" binding="netTcpBinding" contract="MyServiceWCF.IMyService" bindingConfiguration="NetTcpBinging_IMyService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/MyServiceWCF/Service1/" />
</baseAddresses>
</host>
</service>
</services>
感謝您的答覆。我試過,但我得到一個錯誤,客戶端和服務沒有匹配的安全配置。我在客戶端中更改了並將其添加到服務中的app.config中: –
RRhoads
您剛更改了憑證類型,而不是安全模式。 在你的客戶端中,你正在使用tcp綁定,並在你的服務器http。您也必須將客戶端配置更改爲http。你已經從安全中刪除了「transport」元素。安全性有一個屬性「模式」,您可以選擇「無」,或者只是刪除整個「安全」元素。 –
你是對的。但我打算使用Tcp綁定。我正在編輯這個問題來反映這一點。 – RRhoads