添加绑定配置时出错

时间:2016-03-25 07:38:43

标签: c# wcf nettcpbinding

我正在尝试为我的wcf服务添加net.tcp协议。我收到了错误。 绑定配置

执行此操作时出错

详细说明: 对象引用未设置为对象的实例。

Error Picture while adding tcp bindings

 <?xml version="1.0"?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>
  </system.web>
  <system.serviceModel>
    <services>
      <service behaviorConfiguration="WCFSample1.WCFSample1" name="WCFSample1.WCFSample1">
        <endpoint address="webHttp" behaviorConfiguration="webHttp" binding="webHttpBinding" 
                  bindingConfiguration="webHttpBindingConfig" contract="WCFSample1.IWCFSample1" />
        <endpoint address="basicHttp" binding="basicHttpBinding" bindingConfiguration="basicHttpBindingConfig"
                 contract="WCFSample1.IWCFSample1" />
        <endpoint address="" binding="netTcpBinding" bindingConfiguration="NetTcpBindingCofig"
                  contract="WCFSample1.IWCFSample1">
        </endpoint>
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost/WCFSample1/WCFSample1.svc"/>
          </baseAddresses>
        </host>          
      </service>
    </services>
    <bindings>
      <webHttpBinding>
        <binding name="webHttpBindingConfig" bypassProxyOnLocal="true" useDefaultWebProxy="false" 
                 hostNameComparisonMode="WeakWildcard" sendTimeout="10:15:00" openTimeout="10:15:00" 
                 receiveTimeout="10:15:00" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" 
                 maxBufferPoolSize="2147483647" transferMode="Buffered">
          <readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647"/>
        </binding>
      </webHttpBinding>
      <basicHttpBinding>
        <binding name="basicHttpBindingConfig" bypassProxyOnLocal="true" useDefaultWebProxy="false" 
                 hostNameComparisonMode="WeakWildcard" sendTimeout="10:15:00" openTimeout="10:15:00" 
                 receiveTimeout="10:15:00" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" 
                 maxBufferPoolSize="2147483647" transferMode="Buffered">
          <readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647"/>
        </binding>
      </basicHttpBinding>
      <netTcpBinding>
        <binding name="NetTcpBindingCofig" hostNameComparisonMode="WeakWildcard"
                 sendTimeout="10:15:00" openTimeout="10:15:00" receiveTimeout="10:15:00"
                 maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647"
                 transferMode="Buffered">
          <readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647"/>
          <security mode="None"/>
        </binding>
      </netTcpBinding>
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior  name="WCFSample1.WCFSample1">
          <!-- To avoid disclosing metadata information, set the value below to false before deployment -->
          <serviceMetadata httpGetEnabled="false"/>
          <!-- 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="true"/>
          <!-- if you want to parse large messages in WCF  there are some attributes you want to set. One of those is maxItemsInObjectGraph which sets how many objects can be serialized and passed around.-->
          <dataContractSerializer maxItemsInObjectGraph="10000000"/>
        </behavior>
      </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="externalRestWebHttp">
          <webHttp/>
        </behavior>
        <behavior name="webHttp">
          <webHttp helpEnabled="true"/>
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <client>

    </client>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="0" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>

0 个答案:

没有答案