none
Cannot find assembly when connecting to database with impersonation=true RRS feed

  • Question

  • I have a windows service on an app server that periodically calls a custom SharePoint web service on a SharePoint 2007 server.  The custom SharePoint web service that is being called retrieves data from a SQL Server 2005 database and then sends out emails based on the data. 

    The SharePoint web service authenticates a windows user.  That is, the app server that calls it sends credentials for a Windows app account on the SharePoint system. 

    The connection to the SharePoint web service occurs successfully and processing continues up until a retrieve data method uses a data adapter Fill method to fill a dataset retrieved from a Stored Procedure on the SQL Server.  No Open method for the connection is performed (as it is implied in the Fill).

    When the Fill method is executed, the following error is returned:

    Could not load file or assembly 'System.EnterpriseServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Either a required impersonation level was not provided, or the provided impersonation level is invalid. (Exception from HRESULT: 0x80070542)

    The SQL Server is on a domainsetup to use Windows Authentication, but the SharePoint Web Service uses an app account on the SQL Server that doesn't correspond to a domain or windows account.  This works successfully for all other applications that work with this SQL Server.  The connection string uses that app account user name and password and does not specify SSPI.

    Troubleshooting
    If I set Impersonation=false in the web.config, the service functions correctly and no error occurs, whereas with a value of true the error occurs.  Setting the value to false was merely for troubleshooting -- this change cannot be deployed as part of the solution (hence this post).

    Any help would be GREATLY appreciated at this point.

    Thank you,
    BGR
    Sunday, September 27, 2009 6:59 PM

Answers

  • Hi,

    If you not provide the vaild user name pwd for impersonation ,this error will occur verify your impersonation statement in the following format.I hope it will help you.

    <authentication mode="Windows" />
    <!--Here you need to give the valid administrator username pwd -->
    <identity impersonate = "true" userName ="domainname\username" password ="pwd"/>

    Best Regards, C.Gnanadurai ----------------------- Please mark the post as answer if it is helpfull to you
    • Marked as answer by eryang Monday, October 5, 2009 3:29 AM
    Wednesday, September 30, 2009 4:44 AM