Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a virtual machine I use for SharePoint 2010 developement. On this machine I have all rights all permissions. The SQL Server runs there and SharePoint is installed. In this VM I created a Winforms application which reads and handles SharePoint data, mainly list manipulation. It works fine.

The first thing the application does is receiving all list names from a user specified Site-URL via this method:

public static List<String> GetAllListNames(string _siteURL) 
{
    List<String> listNames = new List<string>();

    try 
    {
        using (SPSite site = new SPSite(_siteURL.Trim()))
        {
            using (SPWeb web = site.OpenWeb())
            {
                SPListCollection lists = web.Lists;

                foreach (SPList l in lists)
                {
                    listNames.Add(l.Title);
                }

            }
        }            
    }
    catch (Exception ex) 
    {
        Console.WriteLine(ex);
    }

    return listNames;
}

Now I published the applicatio via Click-Once and installed it on another server (Windows Server 2008 R2). This machine also has SharePoint installed on it. I also have full permission for the site I am trying to connect. Still when I try to connect/ get all list names I get the following Error:

Microsoft.SharePoint.SPException ---> System.Runtime.InteropServices.COMException (0x80131904): 0x80131904 bei Microsoft.SharePoint.Library.SPRequestInternalClass.GetListsWithCallback(String bstrUrl, Guid foreignWebId, String bstrListInternalName, Int32 dwBaseType, Int32 dwBaseTypeAlt, Int32 dwServerTemplate, UInt32 dwGetListFlags, UInt32 dwListFilterFlags, Boolean bPrefetchMetaData, Boolean bSecurityTrimmed, Boolean bGetSecurityData, Boolean bPrefetchRelatedFields, ISP2DSafeArrayWriter p2DWriter, Int32& plRecycleBinCount) bei Microsoft.SharePoint.Library.SPRequest.GetListsWithCallback(String bstrUrl, Guid foreignWebId, String bstrListInternalName, Int32 dwBaseType, Int32 dwBaseTypeAlt, Int32 dwServerTemplate, UInt32 dwGetListFlags, UInt32 dwListFilterFlags, Boolean bPrefetchMetaData, Boolean bSecurityTrimmed, Boolean bGetSecurityData, Boolean bPrefetchRelatedFields, ISP2DSafeArrayWriter p2DWriter, Int32& plRecycleBinCount) --- Ende der internen Ausnahmestapelüberwachung --- bei Microsoft.SharePoint.SPGlobal.HandleComException(COMException comEx)
bei Microsoft.SharePoint.Library.SPRequest.GetListsWithCallback(String bstrUrl, Guid foreignWebId, String bstrListInternalName, Int32 dwBaseType, Int32 dwBaseTypeAlt, Int32 dwServerTemplate, UInt32 dwGetListFlags, UInt32 dwListFilterFlags, Boolean bPrefetchMetaData, Boolean bSecurityTrimmed, Boolean bGetSecurityData, Boolean bPrefetchRelatedFields, ISP2DSafeArrayWriter p2DWriter, Int32& plRecycleBinCount) bei Microsoft.SharePoint.SPListCollection.EnsureListsData(Guid webId, String strListName) bei Microsoft.SharePoint.SPListCollection.Undirty() bei Microsoft.SharePoint.SPBaseCollection.GetEnumerator() bei MPToolBoxServerSide.SharePoint.SPAdapter.GetAllListNames(String _siteURL)

I tried to look up (0x80131904) on the web. SQL Content-DB's Log becoming to big seems often to be the reason for this issue. In my case it is not.

Also when I tried to install the application previously I had an issue with Interop not being installed in the GAC on the second server so I removed all (Interop) references from the project as it still compiles and works fine on my developement machine.

So is it possible that the application simply still misses some .dll but the Exception ctached is not detailed enough? Or is there something els.e I missed?

Btw if I try to execute the very same method using CSOM I can access data without any problems even when the application is not installed on the server but on a Client machine.

Thanks in advance!

share|improve this question
1  
this error 0x80131904 is not from sharepoint rather it is from SQL Server. Possible issues are Temp DB drive or Content DB running out of space, No permission on the database. infragistics.com/community/forums/t/73346.aspx –  Waqas Sarwar MCSE Aug 5 at 1:38

1 Answer 1

up vote 1 down vote accepted

I think this is related to your url, as the client object works I believe that the offending line is:

using (SPSite site = new SPSite(_siteURL.Trim()))

use instead:

using (SPSite site = new SPSite(_siteURL))

You could test the theory by hard coding the url:

using (SPSite site = new SPSite("http://teamsite.sitesh.com/checkthisout/"))

EDIT

for the error your now getting the solution would be found here:

http://blog.sharepointrx.com/2009/08/26/the-web-application-at-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/

similar error to yours but related:

The web application at [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.

this is due to an account that you were using had access to the DB whilst another did not so sharepoint coundnt find the web application.

adding db_owner would give full access to the content database for anyone who is part of that group (like site collection admins)

http://technet.microsoft.com/en-us/library/ms180977(v=sql.90).aspx

share|improve this answer
    
When I try to connect a hardcoded site-url I get System.IO.FileNotFounexception: The Webapplication could not be found... I do not understand why Trim() does affect the url-string anyway?! It did NOT on my developement machine. Weird! –  bodycountPP Aug 4 at 9:14
1  
check this out for your new error: blog.sharepointrx.com/2009/08/26/… –  ali Sharepoint Aug 4 at 9:16
    
what account privlages are used in your test account compared to dev? –  ali Sharepoint Aug 4 at 9:24
    
I have 'Full access' to the Site on both the dev and productive machines. –  bodycountPP Aug 4 at 9:38
    
but the account that your using are they both site collection admins? have you tried with different accounts? –  ali Sharepoint Aug 4 at 11:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.