使用Net.TCP托管WCF服务

使用Net.TCP托管WCF服务,wcf,nettcpbinding,Wcf,Nettcpbinding,我对这一点完全不熟悉,并尝试使用net.tcp绑定托管最简单的WCF服务 我有Windows 7 Professional和IIS7,并启用了非http激活 我启动一个新的WCF服务应用程序 在vs2010中创建项目并编译它。 没有别的了 我删除了我所有的IIS 并添加一个名为WCFHost的新 我打开WcfTestClient.exe并添加 应用程序会找到它 Web.config看起来像这样(未触及) 到目前为止,一切顺利。但是net.tcp绑定呢。我添加了“enabledProtoc

我对这一点完全不熟悉,并尝试使用net.tcp绑定托管最简单的WCF服务 我有Windows 7 Professional和IIS7,并启用了非http激活

  • 我启动一个新的WCF服务应用程序 在vs2010中创建项目并编译它。 没有别的了
  • 我删除了我所有的IIS 并添加一个名为WCFHost的新
  • 我打开WcfTestClient.exe并添加 应用程序会找到它
Web.config看起来像这样(未触及)


到目前为止,一切顺利。但是net.tcp绑定呢。我添加了“enabledProtocols”属性,因此我的applicationHost.config如下所示

       <site name="WCFHOST" id="3">
            <application path="/" applicationPool="WCFHOST" enabledProtocols="http,net.tcp,net.pipe,net.msmq">
                <virtualDirectory path="/" physicalPath="C:\Prosjekter\temp\TestService\TestService" />
            </application>
            <bindings>
                <binding protocol="net.tcp" bindingInformation="808:*" />
                <binding protocol="http" bindingInformation="*:80:" />
            </bindings>
        </site>

然后我转到IIS WCFHost网站并添加binding net.tcp 808:* 然后我修改了我的web.config,使WCF服务看起来像这样。(刚刚更改了端点上的绑定)


当我现在尝试添加服务网络时。tcp://localhost:808/Service1.svc 在我的WcfTestClient.exe中,我得到了错误

错误:无法从网络获取元数据。tcp://localhost/Service1.svc TCP错误代码10061:无法建立连接,因为目标计算机主动拒绝了它。。。。127.0.0.1:808

我的防火墙已关闭。 不过,我看到一件事。。使用netstat-a时,808端口未在此处列出。。应该吗


有人能帮我用nettcp绑定创建我的第一个WCF服务吗?

在IIS上为808上的请求启用了net.tcp绑定? 在IIS管理器/绑定上检查它


正如Tocco所说,检查服务是否正在运行。您可以通过选中以下选项来执行此操作:

netstat/an | find/i“808”

它应该表明:

TCP 0.0.0.0:808 0.0.0.0:0侦听
TCP[::]:808[::]:0正在侦听

如果服务运行正常

要使其在尚未工作时启动,您可以发出:

sc启动网络激活器

从命令行到ttry启动它

即使在那之前,也要确保


还要检查服务是否正在实际运行

我收到了相同的错误消息,并通过在站点上创建TCP绑定来解决它,如下所示:

还可以在高级设置中启用
net.tcp
协议:


非常感谢!我已经为此挣扎了一整天:)
       <site name="WCFHOST" id="3">
            <application path="/" applicationPool="WCFHOST" enabledProtocols="http,net.tcp,net.pipe,net.msmq">
                <virtualDirectory path="/" physicalPath="C:\Prosjekter\temp\TestService\TestService" />
            </application>
            <bindings>
                <binding protocol="net.tcp" bindingInformation="808:*" />
                <binding protocol="http" bindingInformation="*:80:" />
            </bindings>
        </site>
<system.serviceModel>
    <services>
      <service name="WcfService2.Service1" behaviorConfiguration="WcfService2.Service1Behavior">
        <!-- Service Endpoints -->
        <endpoint address="" binding="netTcpBinding" contract="WcfService2.IService1">
          <!-- 
              Upon deployment, the following identity element should be removed or replaced to reflect the 
              identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
              automatically.
          -->
          <identity>
            <dns value="localhost"/>
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="WcfService2.Service1Behavior">
          <!-- 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>
 </system.serviceModel>