System.Web.Services.Protocols.SoapException:服务器无法处理请求

发布于 2024-11-01 10:36:22 字数 1668 浏览 3 评论 0原文

我正在使用 .net webservice 来恢复 sqlserver 中的数据库。我正在使用 SQLDMO.dll 来恢复数据库,当我运行该应用程序时,出现以下错误。

System.Web.Services.Protocols.SoapException:服务器无法处理请求。 ---> System.UnauthorizedAccessException:检索 CLSID 为 {10021CC1-E260-11CF-AE68-00AA004A34D5} 的组件的 COM 类工厂失败,原因如下:80070005。 在 DBReplicatorService.SQLDEMOScripts..ctor() 在 DBReplicatorService.DBReplicatorService.RestoreDB(String sDBName, String sUserName, String sPassword, String sBackupFileName)

我使用如下代码来连接数据库

Dim objBCPExport As New SQLDMO.BulkCopy2
Public objDB As SQLDMO.Database2
Dim objServer As New SQLDMO.SQLServer2

Public Function ConnectDatabaseWithRefresh(ByVal sServerName As String, ByVal sDatabaseName As String, ByVal sUserName As String, ByVal sPassword As String) As Boolean
    Dim bResult As Boolean

    Try
        objServer = New SQLDMO.SQLServer2
        objServer.EnableBcp = True
        objServer.Connect(sServerName, sUserName, sPassword)
        objDB = Nothing
        objDB = objServer.Databases.Item(sDatabaseName)
        objDB.DBOption.SelectIntoBulkCopy = True
        bResult = True
    Catch ex As Exception
        bResult = False
    End Try

    Return bResult
End Function

相同的代码,当我在本地主机中使用时它工作正常(它包含 sql server 2005),并且当我在托管服务器(它包含 sql server 2008)中使用它时,我收到上述错误

我在这些变量初始化中收到错误。

Dim objBCPExport As New SQLDMO.BulkCopy2

我正在使用的连接字符串是

     Dim cnnNewDB As New SqlConnection("Data Source=" + pServer + "Initial Catalog="    +   pDatabase + ";Persist Security Info=True;User ID=" + pUserName + ";Password=" + pPassword)

任何人都可以帮助我解决这个问题。

谢谢, 森希尔。

i am using .net webservice for restoring the database in sqlserver. i am using SQLDMO.dll, to restoring database, when i run the app, i getting the following Error.

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {10021CC1-E260-11CF-AE68-00AA004A34D5} failed due to the following error: 80070005.
at DBReplicatorService.SQLDEMOScripts..ctor()
at DBReplicatorService.DBReplicatorService.RestoreDB(String sDBName, String sUserName, String sPassword, String sBackupFileName)

i am using the code as follows to connect Database

Dim objBCPExport As New SQLDMO.BulkCopy2
Public objDB As SQLDMO.Database2
Dim objServer As New SQLDMO.SQLServer2

Public Function ConnectDatabaseWithRefresh(ByVal sServerName As String, ByVal sDatabaseName As String, ByVal sUserName As String, ByVal sPassword As String) As Boolean
    Dim bResult As Boolean

    Try
        objServer = New SQLDMO.SQLServer2
        objServer.EnableBcp = True
        objServer.Connect(sServerName, sUserName, sPassword)
        objDB = Nothing
        objDB = objServer.Databases.Item(sDatabaseName)
        objDB.DBOption.SelectIntoBulkCopy = True
        bResult = True
    Catch ex As Exception
        bResult = False
    End Try

    Return bResult
End Function

same code when i use in my localhost it is working fine(it contains sql server 2005), and when i use it in hosting server(it contains sql server 2008) i getting the above Error

I getting the error in these variable initialization.

Dim objBCPExport As New SQLDMO.BulkCopy2

and connection string i am using is

     Dim cnnNewDB As New SqlConnection("Data Source=" + pServer + "Initial Catalog="    +   pDatabase + ";Persist Security Info=True;User ID=" + pUserName + ";Password=" + pPassword)

can any one please help me to fix the problem.

Thanks,
Senthil.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

等风也等你 2024-11-08 10:36:23

嘿,
如果您确定用户服务器名称和密码的准确性
您的项目可能无权写入事件日志。
要解决这个问题,请转到
\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\RestrictGuestAccess 并将其值更改为 (0) 以重新启动

hey,
if you're sure about the accuracy of user-server name and password
your project may not has right to write the event log..
to fix that go to
\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\RestrictGuestAccess and change its value to (0) to reboot

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文