发现这可以解释我的一些问题 - MSDN Post
我已经在控制台应用程序中编写了一个wcf服务。然后我有一个与服务交互的客户端。
客户端和服务在我的机器上正常工作。
当我将客户端移动到另一台计算机时,我可以让它工作但我必须在服务器和客户端计算机上关闭防火墙(我假设我可以通过打开服务最终需要的防火墙端口来解决这个问题与?沟通?)但我也必须关闭skype否则我得到“无法注册URL http://+:80/temporary_Listen_Address/ ......”“该进程无法访问该文件,因为它正被另一个进程使用”
我已经阅读了一些关于更改客户端基地址但却无法进行此操作的内容。然而,我可能会遗漏其他东西。我有一种感觉,当我将它移动到我自己的另一台机器时,我应该更改客户端配置中的端点地址,但这打破了设置,所以我保持不变。
这是我的配置。
服务器
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IDataCollector" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="Message">
<message clientCredentialType="UserName" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<services>
<service name="DataCollector" behaviorConfiguration="defaultProfile" >
<endpoint address="http://192.168.1.74:8080" binding="wsDualHttpBinding"
bindingConfiguration="WSDualHttpBinding_IDataCollector" contract="IDataCollector" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="defaultProfile">
<serviceMetadata httpGetEnabled="True"/>
<serviceCredentials>
<serviceCertificate findValue="MyServerCert" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My" />
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="ConsoleHost.UsernameValidator, ConsoleHost" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
客户端
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IDataCollector" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="Message">
<message clientCredentialType="UserName" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.1.74:8080/" binding="wsDualHttpBinding"
bindingConfiguration="WSDualHttpBinding_IDataCollector" contract="AshService.IDataCollector"
name="WSDualHttpBinding_IDataCollector" behaviorConfiguration="myClientBehavior">
<identity>
<certificate encodedValue="AwAAAAEAAAAUAAAA9fenyF3cSS38ldDDxtUyC8TajBAgAAAAAQAAALgBAAAwggG0MIIBYqADAgECAhD3kPMzVBbXlEAT5S65MldSMAkGBSsOAwIdBQAwFjEUMBIGA1UEAxMLUm9vdCBBZ2VuY3kwHhcNMTEwMjExMTU0MDMwWhcNMzkxMjMxMjM1OTU5WjAXMRUwEwYDVQQDEwxNeVNlcnZlckNlcnQwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJ9D8W2GBGvwTAZ2eQj12atxPruZxuOwTCLXRwtEvpnoLmlwBuxo7Wb+of0k4XTNLa7q/Xvjh3zsJbvevlPG3hk9+ugds/Je5X69uPbQApYJO2HZNY9hrwfMZ40iaJ54vVAkdnIhDT5pEpmKVFFkPangk1aMyb6Ilm4NjO9bUxjFAgMBAAGjSzBJMEcGA1UdAQRAMD6AEBLkCS0GHR1PAI1hIdwWZGOhGDAWMRQwEgYDVQQDEwtSb290IEFnZW5jeYIQBjdsAKoAZIoRz7jUqlw19DAJBgUrDgMCHQUAA0EAGT7q1aZwAaJ4sMbv53BOo2/yVSpYkTRIaQwT0uYdY1SLyJ7uaUwqJR0jG+nNqwgyOEOfg4Tz0/dX740dw12+1Q==" />
</identity>
</endpoint>
</client>
<behaviors>
<endpointBehaviors>
<behavior name="myClientBehavior">
<clientCredentials>
<serviceCertificate>
<authentication certificateValidationMode="Custom" customCertificateValidatorType="ConsoleClient.MyX509Validator,ConsoleClient" />
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
亲切的问候
灰
答案 0 :(得分:4)
在客户端应用程序配置中,编辑绑定以包含clientBaseAddress属性。
以下是示例客户端的绑定配置
<bindings>
<wsDualHttpBinding>
<binding name="wsDualHttpBinding.TimeService" closeTimeout="00:01:00"
clientBaseAddress="http://localhost:9090/WCF.ServiceClient.TimeService/">
</binding>
</wsDualHttpBinding>
</bindings>
答案 1 :(得分:3)
Skype具有禁用端口80使用的设置,检查Skype选项。所以skype和你的服务可以共存和工作!
答案 2 :(得分:1)
您的端点地址必须与服务器的计算机/端口/协议匹配。示例中的端点命中端口8080。