Florida
Florida

Reputation: 21

Retrieving the COM class factory for component with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 80040154

I was trying to write a web service that creates a new list in a sharepoint site given the name of the list of its two columns. When I build the solution I do not get any errors, but when I try to use it via a client program I get the following exception:

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 80040154.
   at Microsoft.SharePoint.Library.SPRequest..ctor()
   at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(SPSite site, String name, Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous)
   at Microsoft.SharePoint.SPRequestManager.GetContextRequest(SPRequestAuthenticationMode authenticationMode)
   at Microsoft.SharePoint.Administration.SPFarm.get_RequestAny()
   at Microsoft.SharePoint.SPSecurity.GetCurrentUserTokenNoApplicationPrincipalDelegated()
   at Microsoft.SharePoint.SPSecurity.GetCurrentUserToken()
   at Microsoft.SharePoint.SPSecurity.EnsureOriginatingUserToken()
   at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
   at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
   at CreaListaDatoNome.Service1.CreaLista(String nomeLista, String field1, String field2) in C:\Users\Administrator\documents\visual studio 2010\Projects\CreaListaDatoNome\CreaListaDatoNome\Service1.asmx.cs:line 24
   --- End of inner exception stack trace ---

Now, this is the code of the web service:

namespace CreaListaDatoParametri
{

    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    public class Service1 : System.Web.Services.WebService
    {
        [WebMethod]
        public void CreaLista(string lista, string colonna1, string colonna2)
        {
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite site = new SPSite("http://sp2010devid/sites/Chapter2/"))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        site.AllowUnsafeUpdates = true;
                        web.AllowUnsafeUpdates = true;

                        // Create a new list
                        string description = "The list " +lista+ " was created via a web service";
                        Guid idNuovaLista = web.Lists.Add(lista, description, web.ListTemplates["Custom List"]);

                        //Modify the structure
                        SPList nuovaLista = web.Lists[idNuovaLista];
                        nuovaLista.OnQuickLaunch = true;
                        nuovaLista.EnableFolderCreation = true;

                        nuovaLista.Fields.Add(colonna1, SPFieldType.Text, true);
                        nuovaLista.Fields.Add(colonna2, SPFieldType.Text, true);
                        nuovaLista.Update();
                    } 
                } 
            });
        }//end of WebMethod
    }//end of classe
}//end of namespace

Can anybody please help me??? Googling for a solution I found for example the following:

"Re: Retrieving the COM class factory for component with CLSID {5D34E962-9F95-4D92-917F-F9B1A4F2BC...

I beleive you are asking how to allow access.. Sorry if you are not, but do the following... Under administrative tools->Component services. Under the tree, go to Component Services->Computers->My Computer->DCOM Config. Find the registered com object. Right click for porperties. Under the security tag, customize the Permissions to allow asp.net user... Hope this was what you were looking for..."

Response: "Jeff, thanks a lot for your quick response...the problem I am facing now is how I know if the com object is registered or not...? and if not, how can I register it? I know the CLSID (because the error message tells me the component with CLSID {5D34E962-9F95-4D92-917F-F9B1A4F2BC6E}), but when I look on the list of registered com objects it does not appear. Any help will be appreciated. Thanks in advance."

Response: "You may not actually see the class listed under the CLSID, as it may actually be listed by its name and if you have the Component Services view set on anything other than Detail View you may not see it. Change the View to Detail and then look for this CLSID unter the ApplicationID column."

Now even if I change to Details view I see nothing. Please help me, thanks in advance.

Upvotes: 1

Views: 10244

Answers (1)

Himani Sharma
Himani Sharma

Reputation: 41

Are you adding the list to sharepoint 2010? If yes, what is platform build for your project? Ensure that you build your client application as 64 bit (same as sharepoint server platform)

Upvotes: 4

Related Questions