场景
忽略一些设置可能是错误的、不一致的或根本不存在的事实!
为什么当我尝试将这两个不同的WCF服务配置放到同一个APP.CONFIG文件中时,程序无法编译?一个是我自己写的,另一个是一个朋友写的,但我不能让应用程序编译。我错过了什么?
错误
类型初始化异常
代码
<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>发布于 2010-04-06 18:05:10
以下是一些观察结果:
<client>终结点没有地址:您如何期望您的客户端代码知道连接到哪里??您需要在任何client <endpoint>
<service>端点中指定完整的WCF服务地址-您需要在此处指定完整地址,或者必须在服务中定义基地址!两者中必须有一项存在:或者:
另外,从你的问题可以看出,当你遇到错误时,并不清楚你想要做什么:
https://stackoverflow.com/questions/2583637
复制相似问题