首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何设置WCF Net.Tcp

如何设置WCF Net.Tcp
EN

Stack Overflow用户
提问于 2011-01-27 18:14:29
回答 1查看 13.5K关注 0票数 1

我正在尝试设置一个wcf服务,以便在IIS 7上使用net.tcp。

下面是我遇到的错误:

没有侦听net.tcp://127.0.0.1:8000/ListingService可以接受消息的端点。这通常是由不正确的地址或SOAP操作造成的。有关更多细节,请参见InnerException (如果存在)。

下面是我从客户端调用的代码:

代码语言:javascript
复制
using (var client = new ListingServiceClient("NetTcpBinding"))
{
   client.Test();
   client.Close();
}

这是我的服务web.config - http://pastebin.com/3S8BZbup

代码语言:javascript
复制
<system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding portSharingEnabled="true">
          <security mode="None" />
        </binding>
      </netTcpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="default">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
          <!--throttle service-->
          <serviceThrottling
            maxConcurrentCalls="10000"
            maxConcurrentSessions="10000" 
            maxConcurrentInstances="10000" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <services>
      <service behaviorConfiguration="default" name="Housters.Services.ListingService">
        <endpoint name="TcpEndpoint"
                  address="net.tcp://127.0.0.1:8000/ListingService"
                  binding="netTcpBinding"
                  contract="Housters.Services.IListingService" />
      </service>
    </services>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
  <system.webServer>
      <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

这是我的客户app.config - http://pastebin.com/YpiAhh46

代码语言:javascript
复制
<system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="NetTcpBinding">
          <security mode="None"/>
        </binding>
      </netTcpBinding>
    </bindings>
    <client>
      <endpoint
              address="net.tcp://127.0.0.1:8000/ListingService"
              binding="netTcpBinding" bindingConfiguration="NetTcpBinding"
              contract="ListingServiceProxy.IListingService" name="NetTcpBinding" />
    </client>
  </system.serviceModel>

有什么想法吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-01-28 00:15:49

此配置将无法在IIS/WAS中运行。在IIS中托管时,您需要.svc文件(或WCF 4中基于配置的激活),端点的地址总是VirtualDirectoryPath + SvcFile +端点配置中指定的相对地址。在端点配置中设置绝对地址是为了自我托管。

票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4820172

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档