我有一个WCF文件服务器和客户端在Localhost中工作完美,但是当我将服务器安装到另一台计算机时,当客户端要上传文件时,客户端会引发异常。例外是:WCF文件服务器中的端点
服务器拒绝凭据。
我在客户端的配置文件中添加一个新的服务器IP(172.18.20.25)。
这是我的客户端配置文件:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<client>
<endpoint name="FileRepositoryService"
address="net.tcp://172.18.20.25:5000" binding="netTcpBinding"
contract="FileServer.Services.IFileRepositoryService"
bindingConfiguration="customTcpBinding"/>
</client>
<bindings>
<netTcpBinding>
<binding name="customTcpBinding"
maxReceivedMessageSize="2147483648" transferMode="Streamed"/>
</netTcpBinding>
</bindings>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
这是我的服务器的配置:
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<appSettings>
<add key="RepositoryDirectory" value="storage"/>
</appSettings>
<system.serviceModel>
<services>
<service name="FileServer.Services.FileRepositoryService">
<endpoint name="" binding="netTcpBinding"
address="net.tcp://localhost:5000"
contract="FileServer.Services.IFileRepositoryService"
bindingConfiguration="customTcpBinding" />
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="customTcpBinding" transferMode="Streamed"
maxReceivedMessageSize="2147483648" />
</netTcpBinding>
</bindings>
</system.serviceModel>
</configuration>
当客户端和服务器在一台机器上运行之前提到的它工作得很好。我读过关于添加一个新的WSDL端点到服务器,我不知道它,我不知道如何添加它。你有什么建议?
您使用基本'netTcpBinding'默认为使用Windows用户帐户的安全性。因此,如果您的“新”客户端和“新”服务器不属于同一个Windows域,或者客户端的PC在不属于该Windows域的帐户下运行,则它将不起作用。 – 2012-02-09 08:17:12
阅读[编程WCF安全](http://msdn.microsoft.com/en-us/library/ms731925.aspx),看看哪个设置最适合您的服务 – 2012-02-09 08:17:56