首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WCF多服务配置问题

WCF多服务配置问题
EN

Stack Overflow用户
提问于 2010-04-06 16:55:05
回答 1查看 242关注 0票数 0

场景

忽略一些设置可能是错误的、不一致的或根本不存在的事实!

为什么当我尝试将这两个不同的WCF服务配置放到同一个APP.CONFIG文件中时,程序无法编译?一个是我自己写的,另一个是一个朋友写的,但我不能让应用程序编译。我错过了什么?

错误

类型初始化异常

代码

代码语言:javascript
复制
<configuration>
<system.serviceModel>

  <!--START Service 1 CONFIGURATION-->
  <bindings>
    <netTcpBinding>
      <binding name="tcpServiceEndPoint" closeTimeout="00:01:00"
       openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
       transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
       hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="524288"
       maxBufferSize="65536" maxConnections="10" maxReceivedMessageSize="65536">
        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
         maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        <reliableSession ordered="true" inactivityTimeout="00:05:00"
         enabled="true" />
        <security mode="None">
          <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
          <message clientCredentialType="Windows" />
        </security>
      </binding>
    </netTcpBinding>
  </bindings>
  
  <client>
    <endpoint address=""
     binding="netTcpBinding" bindingConfiguration="tcpServiceEndPoint"
     contract="ListenerService.IListenerService"
     name="tcpServiceEndPoint" />
  </client>
  <!--END Service 1 CONFIGURATION-->


 <!--START Service 2 CONFIGURATION-->
  <services>
    <service name="UploadObjects.ResponseService">
      <!-- Define NetMsmqEndpoint -->
      <endpoint address=""
              binding="netTcpBinding"
              contract="UploadObjects.IResponseService"
              bindingConfiguration="TransactedBinding"/>
     </service>
    </services>
    <bindings>
    <netTcpBinding>
        <binding name="TransactedBinding">
        <security mode="None" />
       </binding>
      </netTcpBinding>
    </bindings>
    <!--END Service 2 CONFIGURATION-->

   </system.serviceModel>
  </configuration>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-04-06 18:05:10

以下是一些观察结果:

  1. 您的<client>终结点没有地址:

您如何期望您的客户端代码知道连接到哪里??您需要在任何client <endpoint>

  • Your <service>端点中指定完整的WCF服务地址-您需要在此处指定完整地址,或者必须在服务中定义基地址!两者中必须有一项存在:

或者:

另外,从你的问题可以看出,当你遇到错误时,并不清楚你想要做什么:

  • 您是否正在尝试启动承载该服务的服务主机?控制台应用程序或IIS?
  • 您是否正在尝试将客户端连接到正在运行的服务?
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2583637

复制
相关文章

相似问题

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