开发者

Silverlight WCF call is too large for sharepoint wcf

开发者 https://www.devze.com 2023-03-21 10:57 出处:网络
I have a silverlight 4 project calling a WCF service deployed on sharepoint 2010. There are two methods a get and and a save,

I have a silverlight 4 project calling a WCF service deployed on sharepoint 2010.

There are two methods a get and and a save,

teh get works fine but the save returns a generic message "Not Found"

The save is passing a large object with 2 lists. If I reduce the size of the list it all works.

So I figure I have to increase the maxReceivedMessageSize, this is easily done on the silverlight side just edit ServiceReferences.ClientConfig.

however I dont know where to do it on teh server side

Where is the binding information on the shaprepoint webserver. I've had a look in \inetpub\wwwroot\wss\VirtualDirectories\80\web.config and it isn't there.

is there an easy way to get the binding info from teh URL?

I tried to setup some bindings for it but I just get errors my attempt is

<binding开发者_如何学运维s>  
     <basicHttpBinding>  
         <binding name="MyDemoBinding">  
             <security mode="TransportCredentialOnly">  
                 <transport clientCredentialType="Ntlm" />  
             </security>  
         </binding>  
     </basicHttpBinding>  
 </bindings>  
 <behaviors>  
     <serviceBehaviors>  
         <behavior name="MyDemoBehavior">  
             <serviceMetadata httpGetEnabled="true" />  
             <serviceDebug includeExceptionDetailInFaults="false" />  
         </behavior>  
     </serviceBehaviors>  
 </behaviors>  
 <services>  
     <service behaviorConfiguration="MyDemoBehavior" name="BEIM.Webservices.Service">  
         <endpoint address="" binding="basicHttpBinding" bindingConfiguration="MyDemoBinding" contract="BEIM.Webservices.IService">  
         <identity>  
             <dns value="localhost" />  
         </identity>  
     </endpoint>  
     <host>  
         <baseAddresses>  
             <add baseAddress=”http://localhost/_vti_bin/BEIM.Webservices” />  
        </baseAddresses>  
     </host>  
     </service>  
 </services> 


got the answer from here

    private static void ConfigureWebService()
    {
        SPWebService contentService = SPWebService.ContentService;
        contentService.ClientRequestServiceSettings.MaxReceivedMessageSize = -1;

        SPWcfServiceSettings wcfServiceSettings = new SPWcfServiceSettings();
        wcfServiceSettings.ReaderQuotasMaxStringContentLength = 10485760;
        wcfServiceSettings.ReaderQuotasMaxArrayLength = 2097152;
        wcfServiceSettings.ReaderQuotasMaxBytesPerRead = 10485760;
        wcfServiceSettings.MaxReceivedMessageSize = 10485760;
        // must be in lower case
        contentService.WcfServiceSettings["service.svc"] = wcfServiceSettings;

        contentService.Update();


    }

I just ran it from a console app

0

精彩评论

暂无评论...
验证码 换一张
取 消