我有一个使用默认安全性(Windows据我所知)正常工作的服务。但我需要启用mi服务以跨不同的域工作,所以我试图禁用安全性以用于测试目的。
这是原始客户:
客户端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:
所以我更正了客户端app.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>
答案 0 :(得分:0)
您不必更改为tcp。 只需为您的服务添加基本的http端点:
<endpoint address="http://rofl.lol" binding="basicHttpBinding" bindingConfiguration="BasicHttpBindingSettings" contract="roflservice" bindingName="BasicHttpBindingSettings/>
并在绑定中将安全性设置为none:
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBindingSettings">
<security mode="None"/>
</binding>
</basicHttpBinding>
</bindings>