异常。System.ServiceModel.AddressAlreadyInUseException: 在IP端点0.0.0.0:808上已经有了一个监听器。

问题描述 投票:0回答:1

当我尝试ping net.tcp监听失败时,得到一个异常。

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools>svcutil 
net.tcp://localhost/TNA/TAServices/AuthenticationManager/mex

结果:重启系统后,立即执行下面的命令会监听。

Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.6.1055.0]
Copyright (c) Microsoft Corporation.  All rights reserved.

Attempting to download metadata from 'net.tcp://localhost/TNA/TAServices/AuthenticationManager/mex' using WS-Metadata Exchange. This URL does not support DISCO.
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.6.1055.0]
Copyright (c) Microsoft Corporation.  All rights reserved.

Error: Cannot obtain Metadata from net.tcp://localhost/TNA/TAServices/AuthenticationManager/mex

If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.  For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.


WS-Metadata Exchange Error
    URI: net.tcp://localhost/TNA/TAServices/AuthenticationManager/mex

    Metadata contains a reference that cannot be resolved: 'net.tcp://localhost/TNA/TAServices/AuthenticationManager/mex'.

    There was no endpoint listening at net.tcp://localhost/TNA/TAServices/AuthenticationManager/mex that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

If you would like more help, type "svcutil /?"

重启系统后,立即执行下面的命令,就会监听到

C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools>svcutil 
net.tcp://localhost/TNA/TAServices/AuthenticationManager/mex

结果。

Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.6.1055.0]
Copyright (c) Microsoft Corporation.  All rights reserved.

Attempting to download metadata from 'net.tcp://localhost/TNA/TAServices/AuthenticationManager' using WS-Metadata Exchange. This URL does not support DISCO.
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.6.1055.0]
Copyright (c) Microsoft Corporation.  All rights reserved.

Error: Cannot obtain Metadata from net.tcp://localhost/TNA/TAServices/AuthenticationManager

If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.  For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.


WS-Metadata Exchange Error
    URI: net.tcp://localhost/TNA/TAServices/AuthenticationManager

    Metadata contains a reference that cannot be resolved: 'net.tcp://localhost/TNA/TAServices/AuthenticationManager'.

    The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:04:59.9843782'.

    An existing connection was forcibly closed by the remote host

它没有被其他进程覆盖。

但是下面的日志显示它被其他进程覆盖了,而不是SMSvcHost。

An error occurred in the Activation Service 'NetTcpActivator' of the protocol 'net.tcp' while trying to listen for the site '1', thus the protocol is disabled for the site temporarily. See the exception message for more details.
 URL: WeakWildcard:net.tcp://username.domainname.com/
 Status: FailedToListen
 Exception: System.ServiceModel.AddressAlreadyInUseException: There is already a listener on IP endpoint 0.0.0.0:808. This could happen if there is another application already listening on this endpoint or if you have multiple service endpoints in your service host with the same IP endpoint but with incompatible binding configurations. ---> System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at System.ServiceModel.Channels.SocketConnectionListener.Listen()
   --- End of inner exception stack trace ---
   at System.ServiceModel.Channels.SocketConnectionListener.Listen()
   at System.ServiceModel.Activation.TransportListener.Go(IConnectionListener connectionListener)
   at System.ServiceModel.Activation.TransportListener..ctor(IPEndPoint endPoint)
   at System.ServiceModel.Activation.TransportListener.Listen(IPEndPoint endPoint)
   at System.ServiceModel.Activation.RoutingTable.TcpStart(MessageQueue messageQueue, BaseUriWithWildcard path)
   at System.ServiceModel.Activation.MessageQueue.Register(BaseUriWithWildcard path)
   at System.ServiceModel.Activation.ListenerAdapter.RegisterBindings(IActivatedMessageQueue queue, Int32 siteId, String[] bindings, String path)
 Process Name: SMSvcHost
 Process ID: 4608

web.config

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data" />
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
    <section name="dns" type="System.Configuration.NameValueFileSectionHandler" />
  </configSections>
  <dataConfiguration defaultDatabase="LocalSqlServer" />
  <dns file="dns.config" />
  <system.web>
    <!-- Web Part -->
    <membership>
      <providers>
        <clear />
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" applicationName="/MVCFramework" />
      </providers>
    </membership>
    <profile enabled="true" defaultProvider="TableProfileProvider">
      <providers>
        <clear />
        <add name="TableProfileProvider" type="Microsoft.Samples.SqlTableProfileProvider" connectionStringName="LocalSqlServer" table="aspnet_Profile" applicationName="/MVCFramework" />
      </providers>
    </profile>
    <!-- End Web Part -->

    <pages validateRequest="false" enableEventValidation="false" enableViewStateMac="false" maintainScrollPositionOnPostBack="false" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
      <controls>
        <add namespace="AjaxControlToolkit" assembly="AjaxControlToolkit" tagPrefix="ajaxToolkit" />
      </controls>
    </pages>
    <customErrors mode="Off">
      <error statusCode="403" redirect="Status.aspx" />
      <error statusCode="404" redirect="Status.aspx" />
    </customErrors>
    <httpCookies httpOnlyCookies="true">
    </httpCookies>
    <trace enabled="false" localOnly="true">
    </trace>
    <httpRuntime maxRequestLength="2097151" executionTimeout="220000" requestValidationMode="2.0" />
    <!-- 
            Set compilation debug="false" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only  
            during development.
        -->
    <compilation debug="true" defaultLanguage="c#" targetFramework="4.0">
      <assemblies>
      </assemblies>
      <buildProviders>
        <add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
      </buildProviders>
    </compilation>
    <sessionState mode="InProc" timeout="6000" cookieless="UseCookies">
    </sessionState>
    <authorization>
      <allow users="?" />
    </authorization>

    <httpHandlers>
      <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
      <add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
    </httpHandlers>
  </system.web>
  <system.net>
    <settings>
      <servicePointManager expect100Continue="false" />
    </settings>
  </system.net>
  <system.webServer>
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="1024000000"></requestLimits>
      </requestFiltering>
    </security>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <remove name="ChartImageHandler" />
      <add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
    </handlers>
    <modules>
      <add name="QueryStringValidation" type="Presentation.Utilities.QueryStringValidation" />
    </modules>
  </system.webServer>

  <system.data>
    <DbProviderFactories>
      <remove invariant="MySql.Data.MySqlClient" />
      <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.3.7.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
    </DbProviderFactories>
  </system.data>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_Framework" closeTimeout="00:50:00" openTimeout="00:50:00" receiveTimeout="00:50:00" sendTimeout="00:50:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="999999999" maxBufferPoolSize="524288" maxReceivedMessageSize="999999999" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="999999999" maxArrayLength="999999999" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None"/>
        </binding>
      </basicHttpBinding>
      <netTcpBinding>
        <binding name="NetTcpBinding_Framework" closeTimeout="00:50:00" openTimeout="00:50:00" receiveTimeout="00:50:00" sendTimeout="00:51:00" transactionFlow="false" transferMode="Streamed" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="999999999" maxBufferSize="999999999" maxConnections="10" maxReceivedMessageSize="999999999">
          <readerQuotas maxDepth="32" maxStringContentLength="999999999" maxArrayLength="999999999" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:50:00" enabled="false" />
          <security mode="None">
            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
            <message clientCredentialType="Windows" />
          </security>
        </binding>
      </netTcpBinding>
    </bindings>
   <client>
      <endpoint address="net.tcp://localhost/TNA/TAServices/AccountManager.svc" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_Framework" contract="AccountManager.IAccountManager" name="NetTcpBinding_Framework" />
  </client>
    <behaviors>
      <endpointBehaviors>
        <behavior name="ClientBehavior">
          <dataContractSerializer maxItemsInObjectGraph="10000000" />
        </behavior>
      </endpointBehaviors>
    </behaviors>
  </system.serviceModel>
  <location path="Common">
    <system.web>
      <authorization>
        <allow users="?" />
      </authorization>
    </system.web>
  </location>
  <system.web.extensions>
    <scripting>
      <webServices>
        <jsonSerialization maxJsonLength="5000000" />
      </webServices>
    </scripting>
  </system.web.extensions>
</configuration>

我需要如何配置windows和web.config文件,以便使该进程 SMSvcHost 会在每次启动后首先监听。这样,我就不会在IP端点0.0.0.0:808上由其他进程默认建立另一个监听器。

c# windows wcf svcutil.exe net.tcp
1个回答
0
投票

你知道的。NetTcp 默认情况下,绑定会在808端口监听请求。因此,在IIS中托管WCF服务时,请确保808端口没有被其他网站使用。另外,我们最好在网站绑定配置中更改另一个端口。WCF net.tcp绑定808:*是什么意思? 另外,为了支持 NetTcp IIS中的协议,请参考以下链接。无法为绑定NetTcpBinding的端点找到与net.tcp方案匹配的基础地址。基础地址方案是[http] 最后,WCF服务的配置文件不支持Nettcp协议,我们应该在服务端点中添加一个带有 NetTcpbinding so that it can work overNetTcp`协议。如果有什么需要我帮忙的,请随时告诉我。

© www.soinside.com 2019 - 2024. All rights reserved.