wsHttpBinding远程服务器返回了意外响应:(400)错误请求,WCF

时间:2013-12-08 17:01:30

标签: .net wcf wcf-binding

我正在尝试在n层架构中跨层发送两个图像(80K字节)和少量数据。

我的项目有以下图层

  1. DAL - 包含CURD的所有类
  2. 业务 - 包含业务组件
  3. ServicesContracts - 包含服务合同(Json)
  4. 服务 - 服务合同的实施
  5. UI流程 - 包含服务引用(OrganizationServiceReference)
  6. UI.Client - 包含客户端逻辑
  7. 主机 - 包含用于托管服务的引用(DAL,业务,实体,服务,ServiceContracts)和web.config
  8. 实体 - 共同实体
  9. 客户端层中的

    app.config

    <configuration>    
        <startup> 
            <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
        </startup>
      <system.web>
        <httpRuntime maxRequestLength="2147483647"/>
        <customErrors mode="Off"/>
      </system.web>
      <system.serviceModel>
        <bindings>
          <wsHttpBinding>
            <binding name="wsHttpOrganizationService"                  
                           closeTimeout="00:05:00"
                           openTimeout="00:05:00"
                           receiveTimeout ="00:10:00"
                           sendTimeout="00:05:00"
                           bypassProxyOnLocal="false"
                           transactionFlow="false"
                           hostNameComparisonMode="StrongWildcard"
                           maxBufferPoolSize="2000000"
                           maxReceivedMessageSize="2147483647"
                           useDefaultWebProxy="true"
                           allowCookies="false">
              <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
                            maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
              <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
              <security mode="None">            
              </security>
            </binding>
          </wsHttpBinding>
        </bindings>
        <client>
          <endpoint address="http://localhost:24218/OrganizationService.svc"
              binding="wsHttpBinding" bindingConfiguration="wsHttpOrganizationService"
              contract="OrganizationServiceReference.IOrganizationService"
              name="wsHttpOrganizationService">
            <identity>
              <userPrincipalName value="GOPALCHETTRI-PC\Gopal Chettri" />
            </identity>
          </endpoint>
        </client>
      </system.serviceModel>
    </configuration>
    
    UI.Process图层中的

    App.config

        <configuration>
            <system.serviceModel>
                <bindings>
                    <wsHttpBinding>
                      <binding name="wsHttpOrganizationService"
                               closeTimeout="00:05:00"
                               openTimeout="00:05:00"
                               receiveTimeout ="00:10:00"
                               sendTimeout="00:05:00"
                               bypassProxyOnLocal="false"
                               transactionFlow="false"
                               hostNameComparisonMode="StrongWildcard"
                               maxBufferPoolSize="2000000"
                               maxReceivedMessageSize="2147483647"
                               useDefaultWebProxy="true"
                               allowCookies="false">
                        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647"
                                      maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
                              <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
                        <security mode="None">                   
                            </security>
                      </binding>                                              
                    </wsHttpBinding>
                </bindings>
                <client>
                    <endpoint address="http://localhost:24218/OrganizationService.svc"
                        binding="wsHttpBinding" bindingConfiguration="wsHttpOrganizationService"
                        contract="OrganizationServiceReference.IOrganizationService"
                        name="wsHttpOrganizationService">
                        <identity>
                            <userPrincipalName value="GOPALCHETTRI-PC\Gopal Chettri" />
                        </identity>
                    </endpoint>
                </client>
            </system.serviceModel>
        </configuration>
    
    主机项目中的

    web.config

    <configuration>
      <appSettings>
        <add key="pageSize" value="10" />
      </appSettings>
      <system.web>
        <compilation debug="true" targetFramework="4.5" />
        <httpRuntime targetFramework="4.5" maxRequestLength="2147483647" />
      </system.web>
      <connectionStrings>
        <add name="default" connectionString="Data Source=GopalChettri-PC\SQL2012;database=POCBCP;User ID=sa;Password=pass;" providerName="System.Data.SqlClient" />
      </connectionStrings>
      <system.serviceModel>
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true">
          <serviceActivations>
            <add factory="System.ServiceModel.Activation.ServiceHostFactory" relativeAddress="./OrganizationService.svc" service="BCP.Services.OrganizationService" />
          </serviceActivations>
        </serviceHostingEnvironment>
        <services>
          <service name="BCP.Services.OrganizationService" behaviorConfiguration="DefaultServiceBehavior">
            <endpoint name="wsHttpOrganizationService" address="" binding="wsHttpBinding" contract="BCP.Services.Contracts.IOrganizationService" />
            <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
          </service>
        </services>
        <bindings></bindings>
        <behaviors>
          <serviceBehaviors>
            <behavior name="DefaultServiceBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <extensions>
          <behaviorExtensions></behaviorExtensions>
        </extensions>
      </system.serviceModel>
    </configuration>
    

    我已经阅读了很多关于此错误的帖子,但没有任何帮助我解决问题。

    请指导我正确的方向,以便我能解决这个问题。

0 个答案:

没有答案
相关问题