繁体   English   中英

在IIS7中托管nettcp WCF服务失败

[英]Hosting nettcp WCF service in IIS7 fails

好的,所以我有一个非常简单的WCF服务,我想在IIS下托管。 我已启用“ Windows Communication Foundation非HTTP激活”,所以这不是问题。 我在装有.NET 4.0的Windows 7计算机上运行IIS 7,5。 我的web.config看起来像这样:

<?xml version="1.0"?>
<configuration>
  <system.serviceModel>
    <services>
      <service name="FirstWcfService.Service" behaviorConfiguration="ServiceBehavior">
        <!-- Service Endpoints -->
        <endpoint address="" binding="netTcpBinding" contract="NetTcpServiceTest.IMySuperService"
            bindingConfiguration="tcpbinding"/>
        <endpoint address="mextcp" binding="mexTcpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <!-- To avoid disclosing metadata information, set the value below to false
              and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes,
               set the value below to true.  Set to false before deployment to avoid
               disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <netTcpBinding>
        <binding name="tcpbinding" portSharingEnabled="true">
          <!--<security mode="None"></security>-->
          <security mode="Transport">
            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign"/>
            <message clientCredentialType="Windows"/>
          </security>
        </binding>
        <binding name="mexTcpBinding" portSharingEnabled="true">
          <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>
  </system.serviceModel>
</configuration>

该服务作为IIS中默认网站下名为“ NetTcpServiceTest”的应用程序托管。 当我尝试在Visual Studio中添加对net.tcp://localhost/NetTcpServiceTest/MySuperService.svc/mextcp的引用时,出现以下错误:

Metadata contains a reference that cannot be resolved: 'net.tcp://localhost/NetTcpServiceTest/MySuperService.svc/mextcp'.
The message could not be dispatched because the service at the endpoint address 'net.tcp://localhost/NetTcpServiceTest/MySuperService.svc/mextcp' is unavailable for the protocol of the address.
If the service is defined in the current solution, try building the solution and adding the service reference again.

并且事件日志中的错误是:

An error occurred while trying to listen for the URL '/LM/W3SVC/1/ROOT/NetTcpServiceTest'. This worker process will be terminated.
 Sender Information: net.tcp
 Exception: System.ServiceModel.WasHosting.TcpAppDomainProtocolHandler/65824025
 Process Name: System.ServiceModel.CommunicationException: The TransportManager failed to listen on the supplied URI using the NetTcpPortSharing service: .

我还为网站和应用程序启用了绑定。 有谁知道如何解决这个问题? 当我在Internet上搜索它时,发现的唯一答案是重新安装IIS和.NET,但这对我来说听起来并不像是真正的解决方案。

如果您在.NET之后安装了IIS,请尝试使用aspnet_regiis.exe

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM