Tuesday, September 20, 2011

The Web application at http://server/ could not be found. - Error

When you create SharePoint console application or create webParts, you usually need to use SPSite class to operate with list, web, etc. Recently I got this exception message and it cause me a small headache to fix it.

The Web application at http://sharepointserver/ could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

Even this message looks like it shows you where the real problem is, the source can be actually somewhere else. I collected some information how to fix it so you can check it first before you will start search somewhere  ;)

1) Try to check if you typed correct server name as message recommend to you.

2) Check if you have set correctly your platform target in project properties

  • Open project properties (Right click on project -> Properties) -> In the left pane select Build folder -> and there select the Platform target to x64


3) Problem can be with alternate access mapping

  • (If you use SP2010) Open Central Administration -> Application Management -> Under Web Application section click on the Configure alternate access mapping
  • Check if Internal URL contain the URL you have used in your source code otherwise you can create a new record
4) Check if the user is farm server administrator

  • Open Central Administration -> Security -> Manage the farm administrators group -> And add the user there

If those steps would not help you can also check these points if the user

  • has Read and Write permissions on the content database
  • is site collection administrator
  • is in WSS_ADMIN_WPG group on the server
If the problem remain try to log as administrator and run your application. If it is work, probably the problem is with the user permission.

Ok then, this is all I found about this exception and I hope it can help somebody as it helps me :)

No comments:

Post a Comment