이미지를 업로드하기 위해 WCF 서비스를 만들었습니다. 작은 이미지가 다양 할 때 잘 동작합니다. 하지만 800KB와 같은 이미지로 시도하면 "원격 서버에서 오류 (400)가 잘못되었습니다."가 표시됩니다. 로그 파일을 볼 때이 예외가 표시됩니다. ThrowMaxReceivedMessageSizeExceeded() maxRequestLength와 몇 가지 다른 설정을 포함하여 여러 가지를 시도해 보았습니다.wcf가 포함 된 큰 이미지 - ThrowMaxReceivedMessageSizeExceeded()
내 웹 사이트에는 WCFApp, WebApplocation, 서비스 요청이있는 BLClient에는 classLibrary가 있습니다.
이 내 설정 파일과 같습니다 WCFApplication의
의 Web.config : 웹 응용의
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="photoShopEntities"
connectionString="metadata=res://*/photoShop.csdl|
res://*/photoShop.ssdl|
res://*/photoShop.msl;
provider=System.Data.SqlClient;provider connection string='Data Source=.\SQLEXPRESS;AttachDbFileName=|DataDirectory|photoShop.mdf;Integrated Security=True;User Instance=True'"
providerName="System.Data.EntityClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</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 information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
의 Web.config :
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
</providers>
</profile>
<roleManager enabled="true">
<providers>
<clear />
<add connectionStringName="ApplicationServices" applicationName="/"
name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
<add applicationName="/" name="AspNetWindowsTokenRoleProvider"
type="System.Web.Security.WindowsTokenRoleProvider" />
</providers>
</roleManager>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IBLServer" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" 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://localhost:50739/PhotoShopWS.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IBLServer" contract="PhotoShopWS.IBLServer"
name="BasicHttpBinding_IBLServer" />
</client>
</system.serviceModel>
</configuration>
의 App.config of classLibrary :
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IBLServer" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" 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://localhost:50739/PhotoShopWS.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IBLServer" contract="PhotoShopWS.IBLServer"
name="BasicHttpBinding_IBLServer" />
</client>
</system.serviceModel>
</configuration>
나는 그것에 대해 많은 답변을 보았지만 문제는 해결되지 않았습니다. 도움을 주시면 대단히 감사하겠습니다!
모든 것을 최대 값으로 설정하는 것에주의하십시오. http://stackoverflow.com/questions/835114/wcf-readerquotas-settings-drawbacks –