积极答复者
不支持不支持协议net.tcp

问题
-
系统是windows7旗舰版,IIS7。在Default Web Site里绑定了net.tcp,绑定信息808:*。
配置文件:
<?xml version="1.0" encoding="utf-8"?>
<configuration><system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="XmlService.WcfXmlService" behaviorConfiguration="XmlService.WcfXmlServiceBehavior">
<endpoint
address="net.tcp://localhost:8000/"
bindingConfiguration="TransactionalTCP"
binding="netTcpBinding"
contract="XmlService.IWcfXmlService">
</endpoint>
</service>
</services>
<bindings>
<netTcpBinding>
<binding
name="TransactionalTCP"
transactionFlow="true"
/>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name = "XmlService.WcfXmlServiceBehavior">
<!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false 并删除上面的元数据终结点 -->
<serviceMetadata httpGetEnabled="false" />
<!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息 -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>错误信息:
不支持协议“net.tcp”。
说明: 执行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.InvalidOperationException: 不支持协议“net.tcp”。
源错误:
执行当前 Web 请求期间生成了未经处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。
堆栈跟踪:
[InvalidOperationException: 不支持协议“net.tcp”。] System.ServiceModel.Activation.HostedTransportConfigurationManager.InternalGetConfiguration(String scheme) +98668 System.ServiceModel.Activation.HostedAspNetEnvironment.GetBaseUri(String transportScheme, Uri listenUri) +24 System.ServiceModel.Channels.TransportChannelListener.OnOpening() +12200164 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +274 System.ServiceModel.Channels.DelegatingChannelListener`1.OnOpen(TimeSpan timeout) +112 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +318 System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout) +72 [InvalidOperationException: “net.tcp://localhost:8000/”处带有协定“"IWcfXmlService"”的 ChannelDispatcher 无法打开其 IchannelListener。] System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpen(TimeSpan timeout) +118 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +318 System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout) +111 System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +318 System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +206 System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +651 [ServiceActivationException: 由于编译过程中出现异常,无法激活服务“/XmlService/WcfXmlService.svc”。异常消息为: “net.tcp://localhost:8000/”处带有协定“"IWcfXmlService"”的 ChannelDispatcher 无法打开其 IchannelListener。。] System.Runtime.AsyncResult.End(IAsyncResult result) +688590 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +190 System.ServiceModel.Activation.ServiceHttpModule.EndProcessRequest(IAsyncResult ar) +310694 System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +94
版本信息: Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.0.30319.237
答案
全部回复
-
你的配置文件有问题。
参考下面修改服务地址
I found the issue. I just removed the address attribute from the service element was
http://stackoverflow.com/questions/5069183/net-tcp-hosted-in-iis7-5-on-windows-7-virtual-machine-using-net-4-0
<service name="SimpleNetTcpService.Service"> <endpoint address="net.tcp://192.168.0.2:12345/SimpleNetTcpService/Service" binding="netTcpBinding" bindingConfiguration="PortSharingBinding" contract="SimpleNetTcpService.IService" />
now
<service name="SimpleNetTcpService.Service"> <endpoint binding="netTcpBinding" bindingConfiguration="PortSharingBinding" contract="SimpleNetTcpService.IService" />
Frank Xu Lei--谦卑若愚,好学若饥
专注于.NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
【老徐的网站】:http://www.frankxulei.com/
【新青年IT培训网】:http://www.54peixun.com/