gpt4 book ai didi

wcf - WCF 中的另一个应用程序正在使用的端口

转载 作者:行者123 更新时间:2023-12-04 18:53:52 25 4
gpt4 key购买 nike

我在尝试使用以下配置运行时遇到了 WCF 自托管应用程序的问题:

  <system.serviceModel>
<services>
<service name="statisticsCollectingService">
<endpoint address="net.tcp://localhost:8200/RadioStatistics/"
binding="netTcpBinding"
contract="RadioStatistics.Services.IStatisticsCollectingService" />
<endpoint address="http://localhost:8100/RadioStatistics/"
binding="basicHttpBinding"
contract="RadioStatistics.Services.IStatisticsCollectingService" />
</service>

<service name="biDataExportService">
<endpoint address="net.tcp://localhost:8001/RadioStatistics/"
binding="netTcpBinding"
contract="RadioStatistics.Services.IBIDataExportService" />
</service>
</services>
</system.serviceModel>

异常发生如下:
System.Configuration.ConfigurationErrorsException: Error creating context 'spring.root': The process cannot access the file because it is being used by another process ---> Spring.Objects.Factory.ObjectCreationException: Error creating object with name 'statisticsCollectingServiceHost' defined in 'config [C:\TTL\zer_rel_12_1_main_TTL_C1077\TTL\CommonTools\RadioStatistics\bin\Debug\RadioStatistics.ServerApp.vshost.exe.Config#spring/objects] line 4' : Initialization of object failed : HTTP could not register URL http://+:8000/RadioStatistics/services/ because TCP port 8000 is being used by another application. ---> System.ServiceModel.AddressAlreadyInUseException: HTTP could not register URL http://+:8000/RadioStatistics/services/ because TCP port 8000 is being used by another application. ---> System.Net.HttpListenerException: The process cannot access the file because it is being used by another process
at System.Net.HttpListener.AddAll()
at System.Net.HttpListener.Start()
at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
--- End of inner exception stack trace ---
at System.ServiceModel.Channels.SharedHttpTransportManager.OnOpen()
at System.ServiceModel.Channels.TransportManager.Open(TransportChannelListener channelListener)
at System.ServiceModel.Channels.TransportManagerContainer.Open(SelectTransportManagersCallback selectTransportManagerCallback)
at System.ServiceModel.Channels.TransportChannelListener.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.HttpChannelListener.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open()
at Spring.ServiceModel.Activation.ServiceHostFactoryObject.AfterPropertiesSet() in l:\projects\spring-net\trunk\src\Spring\Spring.Services\ServiceModel\Activation\ServiceHostFactoryObject.cs:line 176
at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.InvokeInitMethods(Object target, String name, IConfigurableObjectDefinition definition) in l:\projects\spring-net\trunk\src\Spring\Spring.Core\Objects\Factory\Support\AbstractAutowireCapableObjectFactory.cs:line 1264
at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.ConfigureObject(String name, RootObjectDefinition definition, IObjectWrapper wrapper) in l:\projects\spring-net\trunk\src\Spring\Spring.Core\Objects\Factory\Support\AbstractAutowireCapableObjectFactory.cs:line 1860
at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.InstantiateObject(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching, Boolean suppressConfigure) in l:\projects\spring-net\trunk\src\Spring\Spring.Core\Objects\Factory\Support\AbstractAutowireCapableObjectFactory.cs:line 884
--- End of inner exception stack trace ---
at Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.InstantiateObject(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching, Boolean suppressConfigure) in l:\projects\spring-net\trunk\src\Spring\Spring.Core\Objects\Factory\Support\AbstractAutowireCapableObjectFactory.cs:line 901
at Spring.Objects.Factory.Support.AbstractObjectFactory.CreateAndCacheSingletonInstance(String objectName, RootObjectDefinition objectDefinition, Object[] arguments) in l:\projects\spring-net\trunk\src\Spring\Spring.Core\Objects\Factory\Support\AbstractObjectFactory.cs:line 2097
at Spring.Objects.Factory.Support.AbstractObjectFactory.GetObjectInternal(String name, Type requiredType, Object[] arguments, Boolean suppressConfigure) in l:\projects\spring-net\trunk\src\Spring\Spring.Core\Objects\Factory\Support\AbstractObjectFactory.cs:li

运行 Windows XP SP3 已经尝试执行以下操作:

httpcfg set urlacl /u http://+:8100/RadioStatistics/ /a "D:(A;;GX;;;BU)"



(我猜一般授权和/或用户的所有可能的变体 - 比如 DU(对于域用户?)

还试图添加到 IP 列表

httpcfg set iplisten -i 0.0.0.0:8100



这是在我在事件日志中找到一个事件之后:

Unable to bind to the underlying transport for 0.0.0.0:8100. The IP Listen-Only list may contain a reference to an interface which may not exist on this machine. The data field contains the error number.



最糟糕的是,它过去已经开始工作了(几周前我去度假之前)。机器对我来说似乎没有改变,因为它没有被触摸。但是这个错误让我发疯。最糟糕的是,无论选择哪个端口都会发生错误。

当然,在basicHttpBinding 被移除后它可以正常工作。

TIA

罗兰

最佳答案

您可能在同一端口上监听其他内容。尝试运行

netstat -o -n -a 

获取所有进程的列表以及它们正在监听的内容。

关于wcf - WCF 中的另一个应用程序正在使用的端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2056162/

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