WCF中的另一个应用程序使用的端口

Rol*_*and 5 wcf

尝试使用以下配置运行时,我遇到了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>
Run Code Online (Sandbox Code Playgroud)

例外情况如下:

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
Run Code Online (Sandbox Code Playgroud)

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

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

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

还试图添加到IP列表

httpcfg set iplisten -i 0.0.0.0:8100

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

无法绑定到0.0.0.0:8100的基础传输.IP Listen-Only列表可能包含对此计算机上可能不存在的接口的引用.数据字段包含错误编号.

最糟糕的是,它已经在过去工作(几周前我去度假之前).机器似乎没有改变,因为它没有被触及.但这个错误让我发疯.最糟糕的是,无论选择端口如何都会发生错误.

在删除basicHttpBinding之后,它可以完全正常工作.

TIA

罗兰

Shi*_*iji 6

您可能在同一端口上侦听其他内容.试试跑步

netstat -o -n -a 
Run Code Online (Sandbox Code Playgroud)

获取所有进程的列表以及他们正在侦听的内容.