我需要更改我的web.config文件并添加MaxReceivedMessageSize属性
我的web.config – 但在哪里?
我的web.config – 但在哪里?
传入邮件的最大邮件大小限额(65536)已被超出.要增加配额,请在适当的绑定元素上使用MaxReceivedMessageSize属性.
<?xml version="1.0"?> <configuration> <system.web> <compilation debug="false"><assemblies><add assembly="System.Data.Entity,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089" /></assemblies></compilation> </system.web> <system.serviceModel> <behaviors> <serviceBehaviors> <behavior> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer>
解决方法
您需要为要使用的绑定定义绑定配置,然后需要定义服务(在服务器端)和客户端(客户端)上使用该绑定和绑定配置:
<system.serviceModel> <bindings> <!-- pick whichever binding you want .... --> <basicHttpBinding> <!-- binding configuration with a name --> <binding name="ExtendedMaxSize" maxBufferSize="999999" maxReceivedMessageSize="999999" /> </basicHttpBinding> </bindings> <services> <service name="Yournamespace.YourServiceClass" behaviorConfiguration="..."> <!-- define endpoint with your binding and the name of the binding configuration that you have defined just above --> <endpoint address="" binding="basicHttpBinding" bindingConfiguration="ExtendedMaxSize" contract="Yournamespace.IYourServiceContract" /> </service> </services>