首页 新闻 赞助 找找看

asp.net wcf配置问题

0
悬赏园豆:50 [待解决问题]

小弟弄了一天没弄定 实在没办法了 请大神帮忙!

错误信息:

ChannelFactory.Endpoint 上的地址属性为空。ChannelFactory 的终结点必须指定一个有效的地址。

服务端配置文件

 <system.serviceModel>
    <services>
      <service name="WCFService.WcfService" behaviorConfiguration="Gren.Practices.Wcf.BehaviorConfiguration">
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://sunzhijiao:450/" />
          </baseAddresses>
        </host>
        <endpoint address="" binding="netTcpBinding" contract="WCFDBInterFace.IWCFDBService" bindingConfiguration="netTcpBindingConfiguration" />
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="Gren.Practices.Wcf.BehaviorConfiguration">
          <serviceMetadata httpGetEnabled="False" />
          <serviceDebug includeExceptionDetailInFaults="False" />
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <netTcpBinding>
        <binding name="netTcpBindingConfiguration"
                 closeTimeout="00:01:00"
                 openTimeout="00:01:00"
                 receiveTimeout="00:10:00"
                 sendTimeout="00:10:00"
                 transactionFlow="false"
                 transferMode="Buffered"
                 transactionProtocol="OleTransactions"
                 hostNameComparisonMode="StrongWildcard"
                 listenBacklog="10"
                 maxBufferPoolSize="2147483647 "
                 maxBufferSize="2147483647 "
                 maxConnections="10"
                 maxReceivedMessageSize="2147483647 ">
          <readerQuotas maxDepth="64" maxStringContentLength="2147483647 " maxArrayLength="2147483647 " maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
          <security mode="Transport">
            <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
          </security>
        </binding>
      </netTcpBinding>
    </bindings>
  </system.serviceModel>

客户端配置文件(使用svcutil.exe)生成的

<system.serviceModel>
        <bindings>
            <netTcpBinding>
                <binding name="NetTcpBinding_IWCFDBService" 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:10:00"
                        enabled="false" />
                    <security mode="Transport">
                        <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
                        <message clientCredentialType="Windows" />
                    </security>
                </binding>
            </netTcpBinding>
        </bindings>
        <client>
            <endpoint address="net.tcp://sunzhijiao:450/service.svc" binding="netTcpBinding"
                bindingConfiguration="NetTcpBinding_IWCFDBService" contract="IWCFDBService"
                name="NetTcpBinding_IWCFDBService">
                <identity>
                    <servicePrincipalName value="host/sunzhijiao" />
                </identity>
            </endpoint>
        </client>
    </system.serviceModel>

小朋友写代码的主页 小朋友写代码 | 初学一级 | 园豆:3
提问于:2013-06-17 17:46
< >
分享
所有回答(1)
0

客户端调用的的时候,实例化ChannelFactory的时候需要传入Endpoint的名称,这边根据你的配置需要传入 NetTcpBinding_IWCFDBService

Zachary_Fan | 园豆:762 (小虾三级) | 2013-07-02 09:18
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册