Saturday, June 5, 2010

Resolve MachineToApplication error in web.config

Sometime, when you are trying move your SharePoint application from your Staging to Production environment, did you come across this ugly error:

Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

I am sure, this is enough to spoil the party just when you are expecting your SharePoint website to be up-n-running in the live environment. Now the question comes, "How do we fix this darn thing?"

Well for that, you could try the below suggestions. If you read the error message carefully, it has 2 hints already in it.

Hint #1: virtual directory not being configured as an application in IIS

Resolution: Make sure you have correctly configured your web application in IIS Manager. If it is a simple folder in wwwroot directory, you should "convert" it into web application.
  1. Open IIS manager
  2. Find your folder, right-click -"Properties"->"Create" button
  3. Recycle the application pool
Hint #2: c:\inetpub\wwwroot\webservices\...\web.config line XX where XX stands for line number in web configuration file

Resolution: If you do a find for line XX in your web.config, you are sure to reach this line,
For fixing this, comment this line in this fashion and then save the web.config:

Try accessing your site after the above modifications, it should work fine now.
That's all folks!! (for now :D), please let me know if this helped.

No comments:


Related Posts with Thumbnails