If you are using SharePoint client Object Model and you need to change max size of the message you need to pass to Client.svc, what you probably need is to increase the default value. This can occour for example if you are uploading files to a remote SharePoint using client object model.
The message you are receiving when executing query with client obejct model should be something similar to this: "The request message is too big. The server does not allow messages larger than 2097152 bytes."
The property is MaxReceivedMessageSize of ClientRequestServiceSettings.
Default value is 2MB (2097152 bytes).
Use this PowerShell script (from SharePoint Management Shell in Administrative mode with a Farm Administrative Account) to change this value.
In the example this is set to 2GB.
$ws = [Microsoft.SharePoint.Administration.SPWebService]::ContentService
$ws.ClientRequestServiceSettings.MaxReceivedMessageSize = 2147483647
$ws.Update()
Another option is to create a Farm Scoped Feature with this feature receiver:
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPWebService contentService = SPWebService.ContentService;
/* Must set this to -1, else, the MaxReceivedMessageSize value for
SPWebService.ContentService.WcfServiceSettings["client.svc"] will not be used.*/
contentService.ClientRequestServiceSettings.MaxReceivedMessageSize = -1;
// SPWcfServiceSettings has other Properties that you can set.
SPWcfServiceSettings csomWcfSettings = new SPWcfServiceSettings();
csomWcfSettings.MaxReceivedMessageSize = 2147483647; // 2048MB
contentService.WcfServiceSettings["client.svc"] = csomWcfSettings;
contentService.Update();
}
More at: http://msdn.microsoft.com/en-us/library/ff599489.aspx
Tuesday, June 25, 2013
Tuesday, June 11, 2013
Add and Remove an Assembly from the GAC using PowerShell
If you need to add or remove an assembly from Global Assembly Cache without installing SDK o VS and you don't want to disable UAC, you can do that using a simple PowerShell script.
Be sure to execute PowerShell in Administrative mode.
To add an Assembly to the GAC
Set-location "c:\temp"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacInstall("c:\temp\myassembly.dll")
To remove an Assembly from the GAC
Set-location "c:\temp"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacRemove("c:\temp\myassembly.dll")
Be sure to execute PowerShell in Administrative mode.
To add an Assembly to the GAC
Set-location "c:\temp"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacInstall("c:\temp\myassembly.dll")
To remove an Assembly from the GAC
Set-location "c:\temp"
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacRemove("c:\temp\myassembly.dll")
HowTo Clear SharePoint Timer Job Cache
Often during SharePoint development can be usefull to clear Timer Job Cache.
In order to do that we need to do this:
After restarting Windows SharePoint Timer Service you can see that the cache will be repopulate (quite resource expensive activity).
Do that on every SharePoint server in the farm.
In order to do that we need to do this:
- Stop Windows SharePoint Timer Service from Windows Services
- Open C:\ProgramData\Microsoft\SharePoint\Config\<<GUID>> folder
- Delete all the XML files inside the GUID folder.
- Open the Cache.ini file and change the value to 1.
- Save Cache.ini file
- Restart Windows SharePoint Timer Service from Windows Services
After restarting Windows SharePoint Timer Service you can see that the cache will be repopulate (quite resource expensive activity).
Do that on every SharePoint server in the farm.
Labels:
SharePoint,
SharePoint 2007,
SharePoint 2010,
SharePoint 2013
Subscribe to:
Posts (Atom)