[英]The caller was not authenticated by the service (wsDualHttpBinding)
我不需要任何身份驗證,客戶端和服務不會在同一台計算機上和不同的域中。 當我嘗試連接到服務時,出現以下錯誤。
'System.ServiceModel.Security.SecurityNegotiationException'附加信息:服務未對調用方進行身份驗證。
因此,我試圖關閉服務的安全性:
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="CustomDualBinding">
<security>
<message clientCredentialType="None" negotiateServiceCredential="false" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<services>
<service name="WCFServiceWebRoleStockTrading.Service">
<endpoint address="Service.svc" binding="wsDualHttpBinding" bindingConfiguration="CustomDualBinding"
contract="WCFServiceWebRoleStockTrading.IService" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
現在,當我嘗試自行運行服務時,出現以下錯誤消息:
未提供服務證書。 在ServiceCredentials中指定服務證書。
但是我不需要任何安全性。 安裝服務證書意味着我希望我的客戶端安裝相同的證書以進行身份驗證,對嗎? 這不是我想要的。
我對此非常執着,非常感謝您的建議。
我似乎已經找到了。 我發現很難,要在Visual Studio中使用WCF Config編輯器正確解決。 最好是將其復制並粘貼。
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="CustomDualBinding">
<security mode="None" />
</binding>
</wsDualHttpBinding>
</bindings>
<services>
<service name="WCFServiceWebRoleStockTrading.Service">
<endpoint address="" binding="wsDualHttpBinding" bindingConfiguration="CustomDualBinding"
contract="WCFServiceWebRoleStockTrading.IService" />
</service>
</services>
...
</system.serviceModel>
在客戶端中,請確保在您的配置中包含以下內容:
Uri baseAddress = new Uri("http://xxx.cloudapp.net/Service.svc");
WSDualHttpBinding wsd = new WSDualHttpBinding();
wsd.Security = new WSDualHttpSecurity() { Mode = WSDualHttpSecurityMode.None, Message = new MessageSecurityOverHttp() { ClientCredentialType = MessageCredentialType.None, NegotiateServiceCredential = false } };
EndpointAddress ea = new EndpointAddress(baseAddress);
InstanceContext site = new InstanceContext(this);
_client = new ServiceClient(site, wsd, ea);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.