Web application could not be found in SharePoint
Last week, while developing another small integration in SharePoint, I face one error saying “The Web application at http://< SharePoint URL> could not be found. Verify that you have typed the URL correctly”.
Everything was running perfectly the day before, but suddenly this problem appears. I was so surprised to see this. The code was to integrate event handler in SharePoint and trap those events and execute the different methods.
While goggling, I found the MSDN post http://social.msdn.microsoft.com/forums/en-US/sharepointdevelopment/thread/4ddafbb3-de1d-4356-a60a-11117a6dccd4 by Paul Galvin and Paul face the exactly same issue earlier. The error is given below:
“The Web application at http://<SharePoint URL> 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.”:null}
Paul also posted the issue along with the solution at http://paulgalvin.spaces.live.com/Blog/cns!1CC1EDB3DAA9B8AA!687.entry?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+PaulGalvinsSharepointSpace+%28Paul+Galvin%27s+SharePoint+space%29 .
While I drill down a little bit more, I also found the exactly the same System.IO.FileNotFoundException error:
System.IO.FileNotFoundException was unhandled by user code
Message=”The Web application at http://172.20.1.9:2157/sites/medimax 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.”
Source=”Microsoft.SharePoint”
StackTrace:
at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken)
at Microsoft.SharePoint.SPSite..ctor(String requestUrl, SPUserToken userToken)
at Microsoft.SharePoint.SPItemEventProperties.OpenSite()
at Microsoft.SharePoint.SPItemEventProperties.OpenWeb()
at MedimaxWorkflow.MedimaxRegistrationItemEventReceiver.ItemUpdating(SPItemEventProperties properties)
at Microsoft.SharePoint.SPEventManager.RunItemEventReceiver(SPItemEventReceiver receiver, SPItemEventProperties properties, SPEventContext context, String receiverData)
at Microsoft.SharePoint.SPEventManager.RunItemEventReceiverHelper(Object receiver, Object properties, SPEventContext context, String receiverData)
at Microsoft.SharePoint.SPEventManager.<>c__DisplayClass8`1.<InvokeEventReceivers>b__0()
at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state)
at Microsoft.SharePoint.SPSecurity.RunAsUser(SPUserToken userToken, Boolean bResetContext, WaitCallback code, Object param)
InnerException:
It seems to be issue with credential. I changed the app pool, but no luck. Latter on log off from the machine and login as domain administrator, it is now working perfectly. Restarted the machine also help me to use previous credential to work with the solution.


