WCF和我的ASP.NET应用程序

问题描述:

大家好



我有一个网络服务,我想发送一个包含文件的对象。



我得到的问题是它一直抱怨403错误(Request Entity To Large)。



在我的应用程序的Web.config中我有以下内容:

Hi Guys

I have a web service that I want to send an object that contains a file.

The problem I am getting is that it keeps complaining with a 403 error (Request Entity To Large).

In my app''s Web.config I have the following:

<bindings>      
     <basicHttpBinding>
       <binding name="RFServiceSoap" />
       <binding name="BasicHttpBinding_IFeedbackFormService"
             maxBufferSize="6553600"
             maxBufferPoolSize="524288"
             maxReceivedMessageSize="6553600">
         <readerQuotas maxDepth="32" maxStringContentLength="100000"
                       maxArrayLength="16384" maxBytesPerRead="4096"
                       maxNameTableCharCount="16384" />
         <security mode="None" />
       </binding>
        <binding name="BasicHttpBinding_IFeedbackFormService1" />
      </basicHttpBinding>
  </bindings>
  <client>
      <endpoint address="http://localhost:50047/RFService.asmx" binding="basicHttpBinding" bindingConfiguration="RFServiceSoap" contract="RFServices.RFServiceSoap" name="RFServiceSoap" />
      <endpoint
        address="http://localhost/RedfernServices.FeedbackFormService.svc?wsdl"
        binding="basicHttpBinding"
        bindingConfiguration="BasicHttpBinding_IFeedbackFormService"
        contract="FeedbackService.IFeedbackFormService"
        name="RedfernService"
      />
      <!--bindingConfiguration="BasicHttpBinding_IFeedbackFormService"-->
    </client>
  <behaviors>
      <serviceBehaviors>
        <behavior name="">
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>





然后在我的web.config中(我也试过了app.config )在WCF服务上有以下内容:



Then in my web.config (and I''ve tried the app.config too) on the WCF service has the following:

<system.serviceModel>
   <behaviors>
     <serviceBehaviors>
       <behavior name="">
         <serviceMetadata httpGetEnabled="true" />
         <serviceDebug includeExceptionDetailInFaults="false" />
       </behavior>



       <behavior name="ServiceWithMetadata">
         <serviceMetadata httpGetEnabled="true" />
         <serviceDebug includeExceptionDetailInFaults="false" />
       </behavior>

       <behavior>
         <!-- To avoid disclosing metadata information,
         set the values below to false before deployment -->
         <serviceMetadata httpGetEnabled="True" httpsGetEnabled="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="False" />
      </behavior>
     </serviceBehaviors>
   </behaviors>


   <bindings>
     <basicHttpBinding>
       <binding name="LargeSettings"
            maxBufferSize="6553600"
            maxBufferPoolSize="524288"
            maxReceivedMessageSize="6553600">
         <readerQuotas maxDepth="32" maxStringContentLength="100000"
                       maxArrayLength="16384" maxBytesPerRead="4096"
                       maxNameTableCharCount="16384" />
         <security mode="None" />
       </binding>
     </basicHttpBinding>
   </bindings>

   <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

   <services>
     <service name="RedfernServices.FeedbackFormService"
              behaviorConfiguration="ServiceWithMetadata">
       <endpoint address=""
                 binding="basicHttpBinding"
                 bindingConfiguration="LargeSettings"
                 contract="RedfernServices.IFeedbackFormService">
         <identity>
           <dns value="localhost" />
         </identity>
       </endpoint>
       <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
       <host>
         <baseAddresses>
           <add baseAddress="http://localhost:8733/Design_Time_Addresses/RedfernServices/Service1/" />
         </baseAddresses>
       </host>
     </service>
   </services>

 </system.serviceModel>





在查看了tinterweb之后,我得出的结论是,我所拥有的应该是诀窍。但事实并非如此。 :(



我的服务和ASP.NET Web表单应用程序都在运行.NET 4.0。有人能看到我做错了吗?



非常感谢任何帮助。



谢谢



After looking on that there tinterweb, I came to the conclusion that what I have should do the trick. But its not. :(

My service and ASP.NET web forms app are both running .NET 4.0. Can anybody see what I have done wrong?

Any help would be greatly appreciated.

Thanks

嗨Paul,



我在两周前回答了同样的问题。我建议你的问题与邮件的最大尺寸有关。有关详细信息,请参阅此处 [ ^ ]。





欢呼,

Marco Bertschi
Hi Paul,

I have answered the same question about two weeks ago. I suggest your problem has something to do with the maximmum size of the message. For further details, see here[^].


cheers,
Marco Bertschi