WCF 和 Skype 的端口 80 问题

发布于 10-17 10:17 字数 5647 浏览 4 评论 0原文

发现这可以解释我的一些问题 - 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>

亲切的问候

Ash

Found this which may explain some of my problems - MSDN Post

I have written a wcf service hosted inside a console application. I then have a client that interacts with the service.

The client and service work fine on my machine.

When I move the client to another computer, I can get it working but I have to turn the firewall off on both the server and client machine ( im assuming I can fix this just by opening the firewall ports that the service eventually need to communicate with?) but I also have to turn skype off otherwise I get an "could not register URL http://+:80/temporary_Listen_Address/......" "the process could not access the file because it is being used by another process".

I have read some stuff about changing the client base address but could not get this operating. I may however be missing something else. I have a feeling I should be changing the endpoint address in teh client config when I move it to a different machine to my own, but this broke the setup so I left it unchanged.

Here are my configs.

Server

<?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>

Client

<?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>

Kind Regards

Ash

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

攒眉千度2024-10-24 10:17:58

在客户端应用程序配置中,编辑绑定以包含 clientBaseAddress 属性。

以下是客户端绑定配置示例

 <bindings>
   <wsDualHttpBinding>
    <binding name="wsDualHttpBinding.TimeService" closeTimeout="00:01:00"
        clientBaseAddress="http://localhost:9090/WCF.ServiceClient.TimeService/">
    </binding> 
   </wsDualHttpBinding>
</bindings> 

In the client application configuration, edit the binding to include clientBaseAddress attribute.

Below is the sample clients' binding configuration

 <bindings>
   <wsDualHttpBinding>
    <binding name="wsDualHttpBinding.TimeService" closeTimeout="00:01:00"
        clientBaseAddress="http://localhost:9090/WCF.ServiceClient.TimeService/">
    </binding> 
   </wsDualHttpBinding>
</bindings> 
初心2024-10-24 10:17:58

Skype 有禁用端口 80 的设置,请检查 Skype 选项。因此 Skype 和您的服务可以共存并工作!

https://support.skype.com/en-us/faq/FA528/Conflicts-with-applications-such-as-Apache-or-IIS-working-on-port-80-443

Skype has settings to disable the usage of port 80, check skype options. So skype and your service can co-exist and work!

https://support.skype.com/en-us/faq/FA528/Conflicts-with-applications-such-as-Apache-or-IIS-working-on-port-80-443

梦回旧景2024-10-24 10:17:58

您的端点地址必须与服务器的机器/端口/协议匹配。示例中的端点访问端口 8080。

Your endpoint address must match machine/port/protocol of the server. Your endpoint in the example hits port 8080.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文