.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

The Web Application could not be found Error and solutions in SharePoint 2010 object model

Posted By:Dhananjay Kumar       Posted Date: December 02, 2010    Points: 75    Category: SharePoint    URL: http://www.dotnetspark.com  

The Web Application could not be found .verify that you have typed the URL correctly error: SharePoint 2010 object model. In this article I will show how to handle the exception "Web application not found" in SharePoint 2010 object model.
 

The following exception is very frustrating when we start working with SharePoint object model.  Let us investigate how to solve the exception. 


1.gif 


The preceding exception can be encountered in two scenarios 
  1. Trying to use SharePoint 2010 object model in managed application like console or windows application. 
  2. Trying to use SharePoint 2010 object model in WCF Service or Web services. 

Scenario # 1: The above Exception in console or windows application 


Right click on Console/Windows Application project and select properties. 


2.gif 


Click on Application tab and choose the target framework to .Net Framework 3.5.


3.gif 


After changing Target framework to .NET Framework 3.5, click on Build tab.


4.gif

Change the Platform target to Any CPU. 


Now when you run the application, you should not get the exception 


Scenario # 2: Exception when using SharePoint 2010 object model in WCF 


If you are getting the exception while using SharePoint object model in WCF or any Web service. You need to perform the following operations.


Host WCF service in IIS.  See the link below for step by step explanation on how to host WCF 4.0 Service in IIS 7.5


http://dhananjaykumar.net/2010/09/07/walkthrough-on-creating-wcf-4-0-service-and-hosting-in-iis-7-5/


Except we need to make sure that the hosted WCF service is sharing the same application pool with SharePoint. 


5.gif 


Select the Application pool to SharePoint-80.
Try to apply both when you use SharePoint 2010 object model.  I hope this discussion will help you.

 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend