WCF 配置

主要是针对报错:This could be due to the service endpoint binding not using the HTTP protocol.......

(这是网上找的帖子,做个笔记便于查找,没有测试)

Client Config:

<?xml version="1.0"?>
<configuration>  
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="BasicHttpBinding_INextGenService" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
                  <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                    <security mode="None">
                        <transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
                        <message clientCredentialType="UserName" algorithmSuite="Default"/>
                    </security>
                </binding>
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="http://gcotdvm3722126/CAT.NextGenService/NextGenService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_INextGenService" 

                      behaviorConfiguration="endpointBehavior" contract="INextGenService" name="BasicHttpBinding_INextGenService"/>
        </client>
      <behaviors>
        <endpointBehaviors>
          <behavior name="endpointBehavior">
            <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
          </behavior>
        </endpointBehaviors>
      </behaviors>
    </system.serviceModel>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

Server Config:

<?xml version="1.0"?>
<configuration>
  <appSettings>
    <add key="CATDbEnv" value="CATDB_CLOUD2"/>
  </appSettings>
  <connectionStrings>
    <add name="LEGACYCATDB_CLOUD2" connectionString="user id=legacycat;password=legacycat;data source=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = vm-738e-a017.nam.nsroot.net)(PORT = 1522)))(CONNECT_DATA = (SID = CAT)))" providerName="System.Data.OracleClient"/>
  </connectionStrings>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <httpRuntime maxRequestLength ="262144" executionTimeout="103600"/>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/>
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception informaton -->
    <dataContractSerializer maxItemsInObjectGraph="2147483647" />
          <serviceDebug includeExceptionDetailInFaults="false"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>
 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

</configuration>
原文地址:https://www.cnblogs.com/myloveblogs/p/8607501.html