我在SharePoint 2010 Visual Studio空項目中開發了自定義WCF Web服務。自定義SharePoint 2010 WCF服務 - 如何設置MaxReceivedMessageSize參數
我的網絡服務運行良好。問題與我可以發送到此Web服務的請求的大小有關。我意識到這是在300Kb左右。如果我比這更大,服務/客戶端會發送一個例外。
我環顧四周,發現MaxReceivedMessageSize設置可能是我的解決方案。我已經使用FeatureActivated方法來設置使用這種要求該信息的嘗試:
// increase maximum size of requests to this web service: http://msdn.microsoft.com/en-us/library/ff599489.aspx
SPWebService contentService = SPWebService.ContentService;
contentService.ClientRequestServiceSettings.MaxReceivedMessageSize = -1;
SPWcfServiceSettings csomWcfSettings = new SPWcfServiceSettings();
csomWcfSettings.MaxReceivedMessageSize = 10485760; // 10MB
contentService.WcfServiceSettings["PT-SP-P2S-DocumentCreator.svc"] = csomWcfSettings;
contentService.Update(); // access denied thrown here!
與該代碼,我拒絕訪問(我實際上是網站集管理員)。
我也知道這個參數可以在web服務主機的app.config中設置,但是在SharePoint中,我需要在哪裏更改此參數。
謝謝你的接吻! – dutertimes 2010-10-18 18:22:31