Saturday, March 12, 2011

Error: The value cannot be an empty string. Parameter name: xmlFile

You may get the following error when building publishing sites hierarchy: “Provisioning did not succeed. Details: Failed to completely create the subsite 'http://siteurl'. OriginalException: Invalid value. The value cannot be an empty string. Parameter name: xmlFile” Here’s the solution.

Look for definition of site that gave this error and open its template file. You should see there something like this.

<?xml version="1.0" encoding="utf-8"?> <Templates xmlns:ows="Microsoft SharePoint">   <Template Name="Magazines" ID="10007">     <Configuration ID="0"                    Title="Magazines"                    DisplayCategory="Publishing"                    Hidden="FALSE"                    ImageUrl="/_layouts/1033/images/BasicWCMPreview.png"                    Description="Our magazines site."                    ProvisionAssembly="Microsoft.SharePoint.Publishing, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" ProvisionClass="Microsoft.SharePoint.Publishing. PortalProvisioningProvider"                                      SubWebOnly="TRUE"                    >     </Configuration>   </Template> </Templates>

Remove ProvisionAssembly and ProvisionClass attributes from definition, deploy package again and create site again.

The reason is simple – publishing provisioning mechanism expects that you also set attribute for XML-file location that defines subsite tree for current site. If you don’t have subsites tree then you don’t need to use publishing provisioning engine.

Tuesday, March 8, 2011

Debugging SecurityTokenServiceApplication

SharePoint 2010 security token service application is not in debug mode by default and doesn’t expose any problems out from service. This makes ULS logs practically unusable because they give you no idea about problems in token service. To get information running you need to turn on exception details. Here is how to do it.

1. Open security token service in browser

When we open security token service application in browser (http://%3cmachine-name%3e:32843/SecurityTokenServiceApplication/securitytoken.svc) we can see the screen with message:

ServiceThe server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

2. Modify web.config file

Seems like showing the error messages is turned off. To turn error messages on we have to modify web.config file of service. You can find web.config file from the following folder:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\WebServices\SecurityToken

Add the following XML just before closing </behavior> tag:


<serviceDebug includeExceptionDetailInFaults="true" />

Refresh the service page and you should see the exception with trace.

Sunday, March 6, 2011

Could not find any resources appropriate for the specified culture (or the neutral culture) on disk

When you are building site definitions with localization support you may get the following error when creating new site:

Provisioning did not succeed. Details: The site template was not provisioned successfully. Delete this site collection in Central Administration, and then create a new site collection. OriginalException: Could not find any resources appropriate for the specified culture (or the neutral culture) on disk.

baseName: <Resource> locationInfo: <null> fileName: <Resource.resx>

This error means that resource file with name <Resource> is missing from deployment package or it is deployed to incorrect folder. Make sure that this file is located in SharePoint resources folder or in App_GlobalResources folder.