Answered Trouble while dealing with Share Point Object Model

  • Thursday, September 14, 2006 3:48 PM
     
     

    Hello everybody,

     

    I am getting some trouble around SharePoint Object model. I was intended to write a console or windows application that will connect two SharePoint site (One is SharePoint 2003 and the other is SharePoint 2007) and will move/copy documents from one to another. I have tried to connect to the SharePoint 2007 first and it was connecting fine. (I was running my application into the same machine where the SharePoint 2007 is installed). The application was retrieving the Document from the SharePoint 2007 as expected but the trouble raised when it was trying to connect with the SharePoint 2003.

     

    The error was

    The Web Application at 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.

     

    Then I was running the application from the machine where the SharePoint 2003 installed and here it was connecting to WSS 2003 fine but failed to connect to WSS 2007. Here the error is different then the earlier.

     

    The server instance specified was not found.  Please specify the server's address and port.

     

    I have searched the web for this error and found a support article in MSDN.  But I have not found any good by following the approach that the article specified.

     

    Can any body help me to get rid of this trouble?

     

     

    One more thing, Can you help me to find out the answer for the following question,

     

    Is it possible to connect to a SharePoint site and retrieve a document from a machine where the SharePoint is not installed by using the SharePoint object model?

     

     

    Advance Thanks for all kind of suggestions 

     

All Replies

  • Tuesday, October 10, 2006 12:21 PM
     
     Answered

    >> Is it possible to connect to a SharePoint site and retrieve a document from a machine where the SharePoint is not installed by using the SharePoint object model?

     

    It looks like it's not possible.

     

    I need to do a similar thing (connect via OM on Sharepoint from a machine where Sharepoint is not installed) and after my researchs, it appears that it's not possible: you need to use the Web Services.

     

     

    HTH

     

     

    Bye

  • Monday, October 30, 2006 8:41 AM
     
     Answered

    Hi!

    I have the same problem. My web page running on the same web server with WSS v3.0 beta2 and trying to use the WSS OM to retrieve some data from root site. But it fails with the message:

    The Web Application at 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.

     

    I worte simple console application. It runs Ok without any problems and failures. It seems that this problem is accuring only in web applications. I have hard coded IP on my computer and I've done all stuff, discribed in that MSDN article with mapping virtual server name to IP. It doesn't seem that problem with users rights and impersonation.

     

    Does anybody knows how to fix it?

  • Tuesday, November 07, 2006 6:59 PM
     
     Answered

    I passed this issue to a Microsoft support engineer, and here is what he said:

    Based on what I gather from the case notes and the article that was pointed out, I think the customer is running into a known problem when connecting to SharePoint 2003. There is a bug in the wss object model code when connecting to a site using the fully qualified domain name. The problem arises under this circumstance because wss does not go out to the DNS server to do name resolution.

    The scenario of using a fully qualified domain name in the code will only work if the host header is local to the IIS metabase, this is easy to do in a test environment where everything is in the same environment but will not work in a production environment with a DNS server.

     

    The only workaround to this is to use either the IP address or the netbios name of the server rather than passing the fully qualified domain name to the object model when referencing a site.

    So instead of writing code like this:

    SPSite site =new SPSite(http://test.domainname.com);

     

    You need to write it like this:

    SPSite site =new SPSite(“http://<IP address>”); or

    SPSite site =new SPSite(“http://<Server Name>”);

     

    A good way to approach this is to have the IP address encrypted as a key in the configuration file, read the key and decrypt it in the code and use the value to establish the connections to the sites. The advantage of this is that you won’t need to hard code any values in the code.

     

    I think this will take care of the problem for the customer but please let me know the results.

    The customer also had the question of “Is it possible to connect to a SharePoint site and retrieve a document from a machine where the SharePoint is not installed by using the SharePoint object model?”, I have address this below.

    Yes, there are ways to connect to a SharePoint site from a machine which does not have Sharepoint installed, however, you cannot use the object model directly. You will need to create an application (web or console) that will make use of the SharePoint web services hosted on the SharePoint server machine. There is also the option of using FP RPC to connect to and manipulate document libraries.

    --Thanks

    Lisa (ISV Buddy Team)

  • Monday, November 20, 2006 6:15 AM
     
     

    Hi,

    My environment is this standalone instllation of MOSS 2007 Beta 2  (No TR) at W2k3 sp1  (Virtual PC)

    My client environemnt is win xp.

    I hav an Web Service app hosted in to w2k3 server where MOSS exists.

    When i try to add a file thru Web Service using object model i get the following errors.

    when use machine name for opening spweb (SPWeb site = new SPSite(AbsoluteURL).OpenWeb();)

    "The request Failed with HTTP Status 401 UnAuthorized"

    when using ip address at AbsoluteURL

    getting

    The Web Application at http://172.26.7.224:5493/Shared%20Documents/imsd.doc 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.errortested

    But when i use thesame code inside a Winforms application at running from server it works great!!!

    Please show my some light...

    i am held up with a lot behind this trial...

    I have tried the following,

    1. I have proxy server configured at our network tried removed that setting at IE also.

    2. I hav given permission to NETWORK SERVICE ASPNET IUSR Administrator of W2k3 accouts for Sharepoint Web Application (admin site)

    3. Also given permission thru SP Admin website for adding documents to "Shared Documents" for the above accounts.

    tia

    regards

    sahridhayan

     

     

     

     

     

     

  • Monday, November 20, 2006 3:31 PM
     
     

    Hi

    I have also tried

    setting

    site.AllowUnsafeUpdates = true

    It does not help too.

    Please direct me where i am missing.

    tia

    sahridhayan

     

     

  • Friday, December 01, 2006 5:21 PM
     
     

    I'm having the same problem... i wasn't the one who installed sharepoint on the server... so i have no idea if sharepoint was installed using the OM or not... (How can i tell without asking him? office politics hah)

    i tried using the machine name

    i tried using the ip address

    i tried using the fully qualified domain name

    I still get filenotfoundexception as described by the OP (original poster)

  • Friday, March 02, 2007 5:55 AM
     
     
    Did you ever figure this out?  I am having the same problem and it is driving me crazy.  Thanks!
  • Wednesday, March 14, 2007 3:36 AM
     
     

    I too am running into the same issue.  Just wondering if anyone has come across a resolution.

    Thanks.

  • Thursday, March 15, 2007 8:31 AM
     
     

    I have the same problem. Try to set the same ApplicationPool as use WSS for the web-application that use WSS object model.

  • Monday, March 26, 2007 8:51 PM
     
     

    any updates on this?

     

     i tried ("machinename") ("machinename.domain.com") and ("ip address") none of them have worked as i stated above. Do we have any further information about this? Are we only to be using the WSS OM from the server machine?

  • Thursday, March 29, 2007 2:04 AM
     
     
     

    I want to use a web service to connect the sharepoint 2007, and then call the sharepoint object model to do some operations, such as adding web in a specific site.

    But it's running the "SPSite site = new SPSite(http://shareserver:65432/sites/portal)", the system throw a System.IO.FileNotFoundException. The error message just like the post 1 showing.

    I don't know what's wrong with it and how to solve it. Please help me.

     

     

    Thanks.

    Yichuan

  • Thursday, May 03, 2007 3:51 AM
     
     Answered
    Guys,
    I had been struggling with this issue for a couple of weeks and thanks to Ishai, I manage to resolve it. It appears to be a permissions issue. Have a look at:
    http://www.sharepoint-tips.com/2007/04/content-query-limitations-and-object.html

    -- Rob

  • Tuesday, May 22, 2007 2:46 PM
     
     

     Robert Monteiro wrote:
    Guys,
    I had been struggling with this issue for a couple of weeks and thanks to Ishai, I manage to resolve it. It appears to be a permissions issue. Have a look at:
    http://www.sharepoint-tips.com/2007/04/content-query-limitations-and-object.html

    -- Rob

     

    I tried all the suggestions provided in the thread. I still get the error, any one else having the same issue?

    or If you know something I can do to fix this issue, please let me know. thx.

  • Tuesday, May 29, 2007 12:52 PM
     
     
    Not sure if this been answered already or not but if you are running sharepoint object model code from IIS then make sure you are using the same application pool ID as your portal. i.e. SERVICE ACCOUNT.
  • Monday, June 11, 2007 8:33 AM
     
     Proposed
    Hello everyone,

    I have tried everything mentioned here but nothing changed. It is still the same. My web application is using the same application pool as Sharepoint services but I am still getting the same error:

    The Web Application at 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.

    When I run the website loged as administrator user to the computer it is fine and that web application works right, even if I log to sharepoint as regular user. As soos as I log to the computer as regular user the web application throw this erorm even if I am loged to sharepoint as administrator. I do not get it. How this can happen? What the user logged to the computer has to do with the web application? This is serviced by IIS and should use the user specified in the application pool for that web application. Or am I missing something here?

    Please any other suggestions? I would be happy for any other comments.

    Thanks,

    Roman
    • Proposed As Answer by MOSS Debugger Monday, February 02, 2009 4:00 AM
    •  
  • Monday, July 30, 2007 1:16 PM
     
     

    Hi,

    I got the same problem, and i solved it by sharing the same application pool (in the IIS) for both the SSP and the webservice.

     

    Ofer

  • Tuesday, July 31, 2007 10:45 AM
     
     
    Hello,
    I am new in sharepoint...and i recently ran into the same problem as above...In the last post you said you have resolved the problem by sharing the same application pool (in the IIS) for both the SSP and the webservice. Can you pleease tell how can i do that...? I went to  II manager at application pool sharepoint 80 properties... identity..i have changed there my user...from the domain... then i went service accounts web application pool.. and then i have selected windows sharepoint web services... application pool sharepoint 80 and put the same user name and password..(the web service is in the sharepoint 80 application pool) i have used the command iireset /noforce...and i still get the same error
    Thank you in advance Stick out tongue
  • Tuesday, July 31, 2007 2:22 PM
     
     
    Hello again.
    I have tried another thing...
    http://www.nnseek.com/e/microsoft.public.sharepoint.development_and_programming/error_the_web_application_at_http_sitename_could_not_45265844t.html#comments
    SPSecurity.RunWithElevatedPrivileges(delegate()
    {
    // Opening sharepoint server at the relevant address
    using (Site = new SPSite("http://...sitename..."))
    {
    // main code to work with sharepoint
    }
    });
    i don`t know if it is the solution to the problem ... but there the guy said it worked for him... i now get another error...
    "Microsoft.SharePoint - Object reference not set to an instance of an object. -  -    at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2()
       at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
       at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
       at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
       at UploadWinService_.UploadWinService.together()
    "


    i`m trying to make a windows service(which uses a web service) work on a computer with windows xp on it.. on the server the service  works great...but there i got the "web application not found" error..and after i did what i said in the upper text... i got the error above...
    any ideas guys?
    Pleeease....it`s killin` me..
    thx
  • Tuesday, July 31, 2007 2:46 PM
     
     

     

    In the IIS, you need to open the property page of the web appliction that you host the web service. under "Home Directory" Tab, you can chose the appliction pool. make sure that your sharepoint web appliction and your webservice sharing the same application pool name.

     

    Ofer

  • Wednesday, August 01, 2007 12:27 AM
     
     
    I still didn`t manage to do anything...Sad(
    i made a very simple application on the windows xp system(whici is in the network with my sharepoint server)

      try
                {

                   SPSite mysite = null;
                    SPSecurity.RunWithElevatedPrivileges(delegate()
                     {
                    mysite = new SPSite("http://spectradan/");

                     });
                    MessageBox.Show("it works...i`d wish...");
                   
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Source + " - " + ex.Message + " - " + ex.InnerException + " - " + ex.StackTrace);
              
                }

    with this code i get the following exception:
    Microsoft.SharePoint - Object reference not set to an instance of an object. -  -    at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.<RunWithElevatedPrivileges>b__2()
       at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
       at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
       at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
       at openSpSite.Form1..ctor() in C:\Documents and Settings\dan.gheorghe\Desktop\openSpSite\openSpSite\Form1.cs:line 28

    if i try the code :


    try
               {
                    
                 SPSite   mysite = new SPSite("http://spectradan/");

                  
                    MessageBox.Show("it works...i`d wish...");
                   
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Source + " - " + ex.Message + " - " + ex.InnerException + " - " + ex.StackTrace);
              
                }


    i get the following exception...
    Microsoft.SharePoint - The Web application at http://spectradan/ 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. -  -    at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken)
       at Microsoft.SharePoint.SPSite..ctor(String requestUrl)
       at openSpSite.Form1..ctor() in C:\Documents and Settings\dan.gheorghe\Desktop\openSpSite\openSpSite\Form1.cs:line 30

    please...someone help me...explain in detail if you have found a solution..i would be gratefull....
  • Thursday, August 09, 2007 7:48 PM
     
     

    I had the following error.

     

    The Web application at http://vm-ut-sp07-ces5/ 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.

     

    It was a security issue. I marshalled my apllication to the sharepoint server where a custom service was to answer me back with the instantiated objects that can modify the web application. However, by default, it was the NT AUTHORITY that ran the service, not my user. Therefore, it didn't had the access rights to the web application and couldn't connect to it.

     

    Hope it helps.

  • Monday, August 20, 2007 2:49 PM
     
     

     

    Hi Guys,

    Greater problems will have smaller solutions.

    Even I was facing the same issue it has been resolved by changing a settings in IIS.

    1. Go to the properties of the application pool where your service is running.

    2. Click on Identity Tab.

    3. Application Pool Identity - >Predefined->Select 'Local System'.

     

    Hope this works.

     

     

     

  • Tuesday, September 18, 2007 5:28 AM
     
     

    Hi, Universe8883:

     

    I tried your advice once time, but the error is still over there.

     

    Is there anyone who can explain what in cloud leads to such error?

  • Wednesday, September 26, 2007 10:59 AM
     
     

    Well the solution is actually quite easy. I want almost cry when I realize that I've spent three days searching the
    Internet and trying different solutions. I had to write maybe 20 MB of code Smile and no success. Then I tried one thing, from despair more likely and I did not believe it will work, but miraculously it does.

    The only thing to do is to get SPSite in RunWithElevatedPrivileges relation and then close RunWithElevatedPrivileges and the rest of the code to update put behind that.

    So the following code:

    SPSite site = null;
    SPSecurity.RunWithElevatedPrivileges(delegate()
    {
    site = new SPSite("http://sharepointsrv"))
    });
    ... some other code ....
    Guid listGuid = new Guid("0f4ec74e-3338-4ff9-991b-1b8a83af56a7");
    SPList list = lists[listGuid];
    SPListItemCollection items = list.Items;
    SPListItem listItem = items.Add();
    rowNo++;
    listItem[0] = idNo.Text;
    listItem[1] = rowNo;
    listItem[2] = description.Text;
    listItem[3] = qtyNum;
    listItem[4] = unit.SelectedValue;
    listItem[5] = priceNum;
    listItemDevil <img src="/> = currency.SelectedValue;
    listItem.Update();

    ... works beautifully. The Udate comes through without throwing the
    exception and everything is right. Wow, how easy. Smile I am really narky that I
    have spent so much time solving this but happy at the same time that it
    works. I do not know which feeling dominates right now - well probably the
    happiness. Smile))

    Roman

  • Sunday, September 30, 2007 4:26 PM
     
     

     

    Hi,

     

    We are trying to file a document in the sharepoint through a stand alone windows application.

     

    We tried basically everthing that was mentioned above except for the security (which we didn't understand). But we couldn't get it connected. We are still getting the error message

     

    "The Web application at http://<servername>:50000/sites/<listname> 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."

    We are able to connect to the sharepoint server only when it is running in the same server. But when we run the application from different server / client pc, we are getting the above message.

     

    Our need is to connect from different server. Is there any settings that we are missing. Can somebody help us on this.

     

    Regards,

    V.Bhaskar.  

  • Friday, November 30, 2007 9:38 PM
     
     

    " In the IIS, you need to open the property page of the web appliction that you host the web service. under "Home Directory" Tab, you can chose the appliction pool. make sure that your sharepoint web appliction and your webservice sharing the same application pool name. "

     

    This worked for me.

     

    Thanks a lot!

    Mohammad

     

  • Wednesday, December 19, 2007 11:09 PM
     
     

     

    From all of my research thus far, the AppPool that WSS is running in seems to be the solution to this problem, however, what about Unit Testing?  When running tests from within VS2008, there is no option to specify an Application Pool.  How are people unit testing code that uses the Sharepoint OM?  If anyone out there has experience, in this area and can speak to this pitfall, please share your wisdom..  Thanks..
  • Thursday, January 03, 2008 6:41 PM
     
     Proposed

    Just to add to this thread, I found that I saw this error on 64 bit systems, when I compiled my application for the x86 target platform.

     

    I created a console app that opens an access 12 database, and then opens an SPSite on the same server and adds new discussion forum threads based on the content in the Access DB. The server was 64 bit, and to connect to Access 12, I needed to install the Office 2007 Data Connectivity Components. These components don't have a 64 bit version, so if you compile using x64 or Any CPU platform, you get an error that the components are not installed. To get rid of that error, I compiled as x86 platform, and then all of a sudden started getting the "WebApplication at ... could not be found" error.

     

    I guess you can't use the object model on a server that is x64 when you compile your application using x86 target platform.

     

    Hope that helps someone in a similar situation.

    • Proposed As Answer by Andrei Csibi Thursday, April 29, 2010 5:57 PM
    •  
  • Wednesday, January 16, 2008 4:07 PM
     
     Answered
    All, The best solution for this kind of scenario is as follows,

    To interact with a SharePoint Server from out side the SharePoint web server it self, you need to write a SharePoint web service. SharePoint web services are nothing bur regular web service, only difference is that they are configured into the SharePoiint site configurations. And from inside the Web service you can do whatever possible with the Object model. To get the SPSite instance from inside the web service, you even dont need to specify domain names, ip etc. Just doing the following you can have an instance of SPSite

    SPSite siteCollection = SPControl.GetContextSite(HttpContext.Current);
    or
    SPWeb subSite = SPControl.GetContextWeb(HttpContext.Current);

    After creating and deploying a web service into the SharePoint you can talk to the web service from anywhere of the world and the web service will actually make use of object model to talk to SharePoint.

    How to create and deploy web service for SharePoint ..?

    Follow the articles listed below,

    For SharePoint 2003
    For SharePoint 2007

    Thanks! Happy programming Smile

  • Tuesday, February 26, 2008 12:33 AM
     
     

    Same here. I have tried all the suggestions and still getting the error. Please help. Thanks.

  • Friday, March 14, 2008 3:56 PM
     
     

    You can take a looksee at http://www.portalsolutions.net/Blog/Lists/Posts/Post.aspx?List=d03af188%2Da06f%2D4be1%2D99e9%2Dd18606093b99&ID=28
     but that was not my issue.

    I had two servers, one was a newer server (64 bit) that I wanted to use, vs the old 32 bit. Even though it should also have the web app it was still having troubles. So what I did was add an Internal URL in Alternate Access Mappings to point to the new server with the correct port. *Presto*, it started working. I then REMOVED that Internal URL and it continued to work.

    So it appears that it just needed that *bump* to get it going...
  • Monday, March 17, 2008 10:41 PM
     
     

    I had the same problem

     

    The Web application at http://targetfarm/ 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.

     

     

     i am importing from one farm to another farm both both farms or hosted on MOSS 2007.

     both farms are in the same Windows Server 2003 Domain.

     

    I was running my application on a mchine on the source farm when i got the error. when i ran my application on a machine of the target farm it worked fine

     

    My this will give some clue about the problem.

  • Saturday, January 31, 2009 2:49 AM
     
     Proposed Has Code
     

    I experienced the exact same error message when attempting to add a new custom Web Part to the

    page on my production server. No Web Service involved. This Web part accesses an xml file as well as a database using the

    following delegate construct:



    SPSecurity.RunWithElevatedPrivileges(delegate()
    {
        // Opening sharepoint server at the relevant address
        using (Site = new SPSite("http://...sitename..."))
        {
            // main body of code
        }
    });

    In our scenario, the production server has an alternate access mapping: originally called "abc"

    and now called "def". The SpSite constructor expects the machine name to be passed as a string.

    Unfortunately, it does not resolve to the new name ("def"). This is where it bombed out.

     Since ours is a single server MOSS 2007 WFE farm, I was able to hard-code the name of the target

    server when attempting to resolve a path to the virtual directory. Not perfect, but it worked.

    Hopefully, this will be fixed soon... the messages to this forum go back to 2006?

     Anthony :-)
    www.codersbarn.com









  • Monday, February 02, 2009 3:59 AM
     
     
    Hi

    Solution is very simple,Just open IIS got to the website where u getting the problem.

    Right click-->Properties-->Directory Home
    Change the application pool to sharepoint application pool which was used by the sharepoint site


    Regards
  • Monday, February 02, 2009 6:59 PM
     
     
    Hi,

    I'm not sure I understand what you're getting at? I'm using IIS7 on Windows Server2008. Currently the bindings for the SharePoint 80 site are: http::80:,http::80:def

    Should I add ,http::80:abc??

    Thanks,
    Anthony :-)
  • Friday, August 28, 2009 6:27 AM
     
     Proposed
    This Worked for me.....


    Thanks Man
    • Proposed As Answer by Balaji_Milo Friday, August 28, 2009 6:27 AM
    •  
  • Sunday, October 25, 2009 10:44 AM
     
     
    There are a few steps that should be kept in mind:

    1. Any file system access for the web service you wrote requires impersonation in your web.config file.
    2. If the above is not required and you simply need to interact with the SP Object Model then go to IIS.
    - Match the Application Pool of your SP portal site to the Appliation Pool of your WS. This is very important.

    But it won't work yet, you need to go to the security tab in your web service and check 'Allow Anonymous Access' to this website. This will ensure that it runs the WS smoothly without prompting your clients with a user name and password.

    Try it! It worked for me though.
    .NET Reaper
  • Thursday, February 04, 2010 7:19 AM
     
     Proposed

    SPSite site =new SPSite(“http://<IP address>”); or

    SPSite site =new SPSite(“http://<Server Name>”);

    It doesnt matter, the only thing you need to do is:

    Go to Project Properties -> Build -> Target Platform -> Make it Any CPU. (It worked)

    It will definately Work.

    ByDefault, the value is x86, so u need to change it to x86 or any cpu. Any CPU is prefered. Sharepoint gives a very misleading exception.

    Mine worked fine :) :)

    Gaurav Yakhmi
    LMI - Microsoft

    • Proposed As Answer by Preston Park Friday, December 10, 2010 10:09 PM
    •  
  • Thursday, April 08, 2010 6:36 AM
     
     Proposed

    The reason my code was returning this error was due to Code Access Security and the trust level.

    The code I was trying to execute was in a web application in IIS, but it was running under minimal trust.

    I was able to give it more permissions to run by altering the profile under <system.web> and <trust> to:

    <trust level="Full" />

  • Thursday, May 20, 2010 3:23 PM
     
     

    I was experiencing this issue today on Server 2008 R2, and Visual Studio 2010 - Turns out I had to run Visual Studio as an Administrator by right clicking on it...

    http://www.sharepointsteve.com/2010/05/visual-studio-2010-cant-open-an-spsite-object-in-server-2008-r2/

     

     

  • Sunday, November 14, 2010 2:09 PM
     
     

    Hi All,

     

    I just documented  solution for above problem below

    http://dhananjaykumar.net/2010/11/14/the-web-application-could-not-be-found-verify-that-you-have-typed-the-url-correctly-error-sharepoint-2010-object-model/ 

    I tried to give solution  for both scenarios

    1. using SharePoint object model 2010  in Windows / Console application.

    2. using SharePoint object model 2010 in Web service or IIS hosted WCF service

     

     


    Thanks Dhananjay Kumar
    MVP Connected System Developer http://dhananjaykumar.net/
    Contact: dhananjay.kumar@live.com Twitter: http://twitter.com/debugmode_
  • Monday, December 06, 2010 5:57 PM
     
     

    This Issue is more of user permission issue give the following permission

    User Permission SharePoint Site --- Minimum Read Permission

    Sharepoint Server --- Add to WSS_ADMIN_WPG group

    Database --- Sharepoint Content DB (Site collection database) - db_owner permission Sharepoint Config DB (Config DB of sharepoint installation) - - db_owner permission

    Read more in my blog

    http://sharepointinstallation.blogspot.com/2010/12/minimal-permission-required-to-execute.html

  • Friday, December 10, 2010 10:10 PM
     
     
    This worked for me. Thanks.
  • Sunday, December 12, 2010 3:31 AM
     
     

    SPSite site =new SPSite(“http://<IP address>”); or

    SPSite site =new SPSite(“http://<Server Name>”);

    It doesnt matter, the only thing you need to do is:

    Go to Project Properties -> Build -> Target Platform -> Make it Any CPU. (It worked)

    It will definately Work.

    ByDefault, the value is x86, so u need to change it to x86 or any cpu. Any CPU is prefered. Sharepoint gives a very misleading exception.

    Mine worked fine :) :)

    Gaurav Yakhmi
    LMI - Microsoft


    HAHA!  I was like, no way this will work.  it worked :) :) : >
  • Monday, January 17, 2011 8:16 AM
     
     Proposed
    few days back I had to make a console app for target sharepoint 2010 server with visual studio 2010.

    I was getting the error that
    {
    System.IO.FileNotFoundException was unhandled
      Message=The Web application at ********* 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)
           at exprt.Program.Main(String[] args) in E:\hemant\exprt\exprt\Program.cs:line 24
           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException:


    }

    what I did >

    I changed the Project>Properties>Application>target Faremwork to .net frame work 3.5

    and

    Project>Properties>General>Platform Target to "any CPU"


    And my code started working fine

    Hope it may help you out
    • Proposed As Answer by hemantrhtk Wednesday, February 23, 2011 2:35 PM
    •  
  • Monday, January 31, 2011 9:18 AM
     
     

    SPSite site =new SPSite(“http://<IP address>”); or

    SPSite site =new SPSite(“http://<Server Name>”); 

    It doesnt matter, the only thing you need to do is:

    Go to Project Properties -> Build -> Target Platform -> Make it Any CPU. (It worked)

    It will definately Work.

    ByDefault, the value is x86, so u need to change it to x86 or any cpu. Any CPU is prefered. Sharepoint gives a very misleading exception.

    Mine worked fine :) :)

    Gaurav Yakhmi
    LMI - Microsoft

     

    Thanks man,, its work :)

  • Wednesday, February 23, 2011 1:49 PM
     
     
    Same problem i was facing and it get solved, I run my Visual Studio by administrator privileges , to do this simply right click on Visual Studio from Run and select "Run as Administrator", that's it.

    w: http://www.worldofsharepoint.com | t: @sharesandip
  • Wednesday, April 27, 2011 9:20 PM
     
     

    Thanks a lot!  Gaurav Yakhmi

    It worked for me. 

  • Friday, May 06, 2011 11:25 AM
     
     

    Hi All,

    I want to try this AppPool solution since many responses says it works. However I am not sure where to change it. I have one Win2003 Server where sharepoint is installed. On this server for SharePoint webapp I have set SP-80 app pool.

    Now I have one webservice which is hosted on same server. This webservice actually uses Object model to create SiteCollection. If I invoke this webservice on same server my CreateSiteCollection method works fine. But when I try to use this web service from another machine(WinXP). I am getting "The Web application at http://ServerURL/ could not be found." error.

    So I have already checked Apppool of SharePoint web app on Win2003 server in IIS. Now can someone tell me which is another location to set the same Apppool.

    Thanks,

    SP

  • Tuesday, June 21, 2011 2:54 PM
     
     

    Hey ,

    Please you dont answer. Why are you answering same again and again. You answer doesnt meet to the requirment.

    Thanks,

  • Wednesday, July 06, 2011 10:50 AM
     
     

    For configuring custom web service in SharePoint 2010, follow below link

    http://srinutamada1.wordpress.com

     


    Srinu Tamada
  • Friday, July 22, 2011 6:24 AM
     
     

    OH GOD i Found out solution :)

    in my case i was making a Utility in C# which was suppose to connect to my web site and populate Lists of that site i was Facing the same problem which you guys are facing....

    its for sure in my case was a rights problem

    ultimately i run my abc.exe file with right click and with run as administrator. and it worked :)

  • Wednesday, August 24, 2011 6:42 PM
     
     
    Thanks for your reply. Nice to hear :))
  • Wednesday, April 25, 2012 2:23 PM
     
     Proposed
    I was getting the same error and it was an alternate access mapping issue.

    http://riedoh.blogspot.com/2012/04/web-application-at-httpxxxxxxxxx-could.html
    • Proposed As Answer by Riedoh Salie Wednesday, April 25, 2012 2:23 PM
    • Edited by Riedoh Salie Wednesday, April 25, 2012 2:27 PM
    •