【发布时间】:2014-08-01 06:47:17
【问题描述】:
首先,我在 winform 中托管我的 wcf 服务并尝试使用 wsHttpBinding。我的客户端应用程序仅在我的开发计算机中工作。为什么我的 WCF wshttpbinding 客户端在另一台计算机上不起作用?在另一台计算机上,当我执行服务时,它显示“调用者未经服务验证”
这是我的 WCF winform 主机配置(app.config):
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<connectionStrings>
<add name="DBCS"
connectionString="data source=localhost;DataBase=LatihanSP;Integrated Security=SSPI"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="XServerSvcBehavior">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="XServerSvcBehavior" name="ServerTier.ServiceClient">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration=""
name="XServerSvcBasicHttpEndPoint" contract="ServerTier.IServiceClient" />
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
name="XServerSvcMexHttpEndPoint" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:7777/SampleSvc" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
这是我的客户端 app.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="XServerSvcBasicHttpEndPoint" />
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:7777/SampleSvc" binding="wsHttpBinding"
bindingConfiguration="XServerSvcBasicHttpEndPoint" contract="ServiceRef.IServiceClient"
name="XServerSvcBasicHttpEndPoint">
<identity>
<userPrincipalName value="Kevin-EDP\Kevin" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
我尝试将 userPrincipalName 值更改为计算机的名称,但我的客户端仍然无法工作,当我执行服务时,它显示“调用者未经服务验证” 我真的很确定我的代码可以正常工作,当我使用 basicHttpBinding 时,当我在互联网上查看一些解决方案时,大多数人建议使用 basicHttpBinding,但这不是我想要的答案,出于安全原因,我想使用 wsHttpBinding
帮帮我,我被困了将近 3 天,仍然无法弄清楚
【问题讨论】: