0

Scneario : Webserver with ASP.NET site. Installed Sharepoint 2010 SQL Express edition on the same server. SQL resides on the same box.

The ASP.NET runs on appPool1 with identity "SiteUser". The Sharepoint site that was created by the wizard has created new app-pool and the app-pool is set with network identity as 'Networkservice account'

Within one of the pages (common.aspx.cs), I read the sharepoint site using the below code.

        SPSecurity.RunWithElevatedPrivileges(delegate()
        {
        using (SPSite site = new SPSite(cSPSite))
        {
                    ...
        }
        });

Here are the errors.

The Web application at http://x2009:190/ 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 did google a bit and no success yet. I can't compile this as it is ASP.NET site. I tried to change the identity of sharepoint site to be that of ASP.NET site (siteuser) and error still remains and this time my sharepoint site (when browsed separately) gives 'cannot connect to configuration database'. I even tried to change the sharepoint site to point the same app-pool that ASP.NET uses but no success so far.

Please suggest.

Anirudh
  • 581
  • 5
  • 14
  • 32
  • I thought this was not that difficult. Anyone has any suggestions or opinions? – Anirudh Nov 14 '11 at 23:20
  • did you install sharepoint on the same iis site as asp.net? – AyKarsi Nov 17 '11 at 16:01
  • @AyKarsi : Sharepoint is a different site but on the same server. So when I goto inetmgr, I can see both site (asp.net and sharepoint site). – Anirudh Nov 17 '11 at 16:26
  • htpp://x2009:190/ is the central admin. Correct? Are you trying to compile an asp.net site inside a default sharepoint site? – AyKarsi Nov 17 '11 at 17:20
  • @AyKarsi: htpp://x2009:190/ is not the central admin. It is regular sharepoint site. I am compiling the above in ASP.NET site project. Both ASP.NET and sharepoint are on the same server. – Anirudh Dec 14 '11 at 20:30

4 Answers4

2

You should check whether this sitename http://x2009:190/ is registered in SharePoint as alternative mapping (or something like this) also it must be exactly x2009 without any .bla.bla. Also this user must have security rights to use webservices (set up in SharePoint).

Maxim Nakhod
  • 106
  • 5
0

You can't do it from ASP.NET site to SharePoint 2010 or earlier server, due to 'cross-site' security limitations. You can use the Client Object Model and access SharePoint 2010 from a managed client (Windows app) or Silverlight app, or ECMAScript in a web part on the server.

Your option from ASP.NET is to use (consume) SharePoint Web Services.

SharePoint 2013 does have a means to allow cross-site access.

0

Try to use the SPFarm account as app pool. I got this error and can't figure out what permission I need. but if I use SPFarm, it runs ok

0

Is your Asp.Net targeting 64 bit platform? If not you are bound to get that error as SharePoint 2010 requires your code to be in 64 bit.

Nitin Rastogi
  • 1,446
  • 16
  • 30