相关疑难解决方法(0)

Windows Service通过HTTPS托管WCF

我已根据MSDN的这些说明创建并配置了SSL证书.我收到此问题列出的错误消息,但不知道如何将该问题中接受的答案映射到我的App.config文件.配置文件的内容和服务本身在http上正常工作,只是在https上发生了问题.

我的App.config文件目前是:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="TransportSecurity">
          <security mode="Transport">
            <transport clientCredentialType="None"/>
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <services>
      <service name="LookupServiceHost" behaviorConfiguration="serviceBehaviour">
        <host>
          <baseAddresses>
            <add baseAddress="https://localhost:54321/MyService"/>
          </baseAddresses>
        </host>
        <endpoint address="" binding="wsHttpBinding" contract="ILookupService" bindingConfiguration="TransportSecurity" />
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="serviceBehaviour">
          <serviceMetadata httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="False"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>
</configuration>
Run Code Online (Sandbox Code Playgroud)

Windows事件日志中返回的错误异常:

服务无法启动.System.ServiceModel.AddressAlreadyInUseException:HTTP无法注册URL https:// +:54321/MyService /.另一个应用程序已经使用HTTP.SYS注册了此URL.---> System.Net.HttpListenerException:无法侦听前缀' https:// +:54321/MyService / ',因为它与计算机上的现有注册冲突.

有人可以给我一个指针,说明如何启用它?

c# wcf windows-services

19
推荐指数
1
解决办法
2万
查看次数

升级到.NET 4.5后获取AddressAlreadyInUseException

我最近在我的服务器上安装了新的.NET Framework 4.5(以前安装了4.0),System.ServiceModel.AddressAlreadyInUseException当我启动公开WCF端点的Windows服务时,我得到了一个.

System.ServiceModel.AddressAlreadyInUseException:IP端点0.0.0.0:56543上已有一个侦听器.如果有另一个应用程序已在此端点上侦听,或者如果服务主机中有多个服务端点具有相同的IP端点但具有不兼容的绑定配置,则可能会发生这种情况.---> System.Net.Sockets.SocketException:System的System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot,SocketAddress socketAddress)通常只允许使用每个套接字地址(协议/网络地址/端口). System.SServiceModel.Channels.SocketConnectionListener.Listen()中的Net.Sockets.Socket.Bind(EndPoint localEP)---内部异常堆栈跟踪的结束---在System的System.ServiceModel.Channels.SocketConnectionListener.Listen()处.
Service.ServiceModel.Channels.BuclusiveConnectionListener.Listen ()位于System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)的System.ServiceModel.Channels.ExclusiveTcpTransportManager.OnOpen()处于System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)at at Sy中的System.ServiceModel.Channels.ConnectionOrientedTransportChannelListener.OnOpen(TimeSpan超时)的System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan超时)System.ServiceModel.Channels上的System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan超时)处的System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan超时)处的stem.ServiceModel.Channels.TcpChannelListener`2.OnOpen(TimeSpan timeout). System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan超时)上的CommunicationObject.Open(TimeSpan超时),位于Qosit.Infrastructure.UnisServer.OnStart(String [] args)的System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan超时)

我的WCF端点的配置如下所示:

<system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="NetTcpBindingConfiguration" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
          <readerQuotas maxDepth="32" maxStringContentLength="5242880" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
        </binding>
      </netTcpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
        <behavior name="MEX">
          <serviceMetadata/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service behaviorConfiguration="MEX" name="MyAssembly.MyNamespace.MyService">      
        <endpoint address="net.tcp://localhost:56543/MyService"
          binding="netTcpBinding" bindingConfiguration="NetTcpBindingConfiguration" contract="MyAssembly.MyNamespace.MyServiceInterface" />
        <endpoint …
Run Code Online (Sandbox Code Playgroud)

configuration wcf .net-4.0 .net-4.5

6
推荐指数
1
解决办法
8706
查看次数

wcf System.ServiceModel.AddressAlreadyInUseException

如果这个问题在stackOverflow上出现两次,请道歉

我试图在Windows Server 2003框上运行wcf服务.我在服务主机调用Open()时收到System.ServiceModel.AddressAlreadyInUseException异常,它告诉我以下错误:

HTTP无法注册URL http:// +:8080/LogoResizer/mex /,因为TCP端口8080正被另一个应用程序使用

我读过我需要使用httpcfg.exe来注册我的命名空间,并且我已经使用了这里的GUI工具来完成它,但我仍然得到上述异常.运行"netstat -a"并不显示在端口8080上侦听的任何内容,并且运行"httpcfg.exe query urlacl"会返回以下注册的命名空间.

C:\ Program Files\Support Tools> httpcfg query urlacl URL:http:// +:80/Temporary_Listen_Addresses /

ACL:D:(A ;; GX ;;; WD)

URL : http://+:8080/LogoResizer/
Run Code Online (Sandbox Code Playgroud)

ACL:D:(A ;; GX ;;; WD)

URL : http://+:8080/LogoResizer/mex/
Run Code Online (Sandbox Code Playgroud)

ACL:D:(A ;; GX ;;; WD)

我的应用程序的配置如下:

<system.serviceModel>
    <bindings>
        <netTcpBinding>
            <binding name="NetTcpBinding_ImageResizerServiceContract" closeTimeout="00:01:00"
                openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
                hostNameComparisonMode="StrongWildcard" listenBacklog="10"
                maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="10"
                maxReceivedMessageSize="2147483647">
                <readerQuotas maxDepth="2147483647"
                              maxStringContentLength="2147483647"
                              maxArrayLength="2147483647"
                              maxBytesPerRead="2147483647"
                              maxNameTableCharCount="2147483647" />
                <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> …
Run Code Online (Sandbox Code Playgroud)

wcf httpcfg.exe

3
推荐指数
1
解决办法
1万
查看次数