Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/261.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在WCF中的添加服务引用中找不到net.tcp终结点?_C#_Wcf_Net.tcp - Fatal编程技术网

C# 在WCF中的添加服务引用中找不到net.tcp终结点?

C# 在WCF中的添加服务引用中找不到net.tcp终结点?,c#,wcf,net.tcp,C#,Wcf,Net.tcp,我对WCF和net.tcp绑定有一个共同的问题。 我看到stackoverflow上的所有帖子也在谷歌上搜索 主要问题是我无法向我的客户端添加服务引用。 我得到一个错误: Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http]. 我正在使用iis7。我选中了非

我对WCF和net.tcp绑定有一个共同的问题。 我看到stackoverflow上的所有帖子也在谷歌上搜索

主要问题是我无法向我的客户端添加服务引用。 我得到一个错误:

Could not find a base address that matches scheme net.tcp for the endpoint with binding NetTcpBinding. Registered base address schemes are [http]. 
我正在使用iis7。我选中了非HTTP。我在Enable Protocols net.tcp中将其添加到了网站中,还将net.tcp添加到了绑定中。如果我点击浏览我的地址。我在WCF应用程序中看到我的文件夹,如果我选择svc文件,我会看到正常地址:

svcutil.exe.net。tcp://MYADDRESS/Service.svc/mex

如果我看到这个URL,我想我的IIS设置是正确的

但当我尝试向客户机添加引用时,问题就开始了。我只看到http端点,没有看到net.tcp

这是我的服务配置:

<?xml version="1.0"?>
<configuration>

      <appSettings>
        <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
      </appSettings>
      <system.web>
        <compilation debug="true" targetFramework="4.5" />
        <httpRuntime targetFramework="4.5"/>
      </system.web>
      <system.serviceModel>
        <services>
          <service name="MYSERVICE.SERVICE" behaviorConfiguration="behavior1">
            <endpoint 
                      binding="netTcpBinding"
                      contract="MYSERVICE.ISERVICE"> 
              <identity>
                <dns value="localhost" />
              </identity>
            </endpoint>
            <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
            <host>
              <baseAddresses>
                <add baseAddress="net.tcp://localhost:60745/MYSERVICE/SERVICE/"/>
              </baseAddresses>
            </host>
          </service>
        </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="behavior1">
          <serviceMetadata httpGetEnabled="false" httpsGetEnabled="false"/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="netTcpBinding" scheme="net.tcp" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>
注意:我的网站从60745地址开始,但对于IIS中的net.tcp绑定,我添加了60746:* 我还为这两个端口打开了入站-出站规则


谢谢大家!

从您在评论中提到的问题来看,我自己也运行过,添加服务引用的gui不能很好地处理mexTcpBinding

您可以将HTTP mex用于元数据,但仍然可以将net.tcp用于数据通道。下面是我的一个项目中的一个示例,该项目将tcp通道与http mex结合使用


在IIS服务器上的Windows特性中是否打开了Windows通信基础非HTTP激活?如果您的程序是.NET 4.5,是否在.NET Framework 4.5高级服务中启用了TCP激活?如果运行IIS的OS具有什么含义?我的服务TCP激活器和端口共享正在工作。我找不到此TCP激活。第一次听说itI通过了TCP激活。当时我没主意了,对不起: