gpt4 book ai didi

wcf System.ServiceModel.AddressAlreadyInUseException

转载 作者:行者123 更新时间:2023-12-01 12:01:56 27 4
gpt4 key购买 nike

如果此问题在 stackOverflow 上出现两次,我们深表歉意

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

HTTP could not register URL http://+:8080/LogoResizer/mex/ because TCP port 8080 is being used by another application



我读到我需要使用 httpcfg.exe 来注册我的命名空间,并且我使用了找到的 GUI 工具 here这样做,但我仍然得到上述异常。运行“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/

ACL : D:(A;;GX;;;WD)
URL : http://+:8080/LogoResizer/mex/

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" />
<security mode="Transport">
<transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
<message clientCredentialType="Windows" />
</security>
</binding>

</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="LogoResizer.WCF.ServiceTypes.ImageResizerService" behaviorConfiguration="ServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:900/mex/"/>
<add baseAddress="net.tcp://localhost:9000/" />
</baseAddresses>
</host>
<endpoint bindingConfiguration="NetTcpBinding_ImageResizerServiceContract" binding="netTcpBinding" contract="LogoResizer.WCF.ServiceContracts.IImageResizerService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>

有谁知道我做错了什么或如何注册我的命名空间以便我可以为我的服务提供一个 http 端点?

最佳答案

解决了。

问题是我的两个端点都在同一个端口上运行。在 windows XP 下开发时这不是问题,但会给你我写的尝试在 Vista 或 windows server 2003 下运行服务时的异常(exception)情况。我只需要将我的服务器配置更新为以下

   <baseAddresses>
<add baseAddress="http://localhost:9000/mex/"/>
<add baseAddress="net.tcp://localhost:9001/" />
</baseAddresses>

关于wcf System.ServiceModel.AddressAlreadyInUseException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/468991/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com