2011-06-22 143 views
0

將應用程序從本地計算機移動到Web服務器時出現錯誤。 (我沒有得到我的本地主機上的錯誤)將ASP.NET應用程序部署到Web服務器時出現問題

拋出異常的代碼如下:

Dim sSQL As String 
Dim strXSLFile As String 
sSQL = "<?xml version=""1.0"" ?>" 
sSQL += "<ROOT xmlns:sql=""urn:schemas-microsoft-com:xml-sql"">" 
sSQL += "<sql:header>" 
sSQL += "<sql:param name='uid'/>" 
sSQL += "<sql:param name='pwd'/>" 
sSQL += "</sql:header>" 
sSQL += "<SESSION>" 
sSQL += "<LANG>" & lang & "</LANG>" 
sSQL += "<SSN>" & Session.SessionID & "</SSN>" 
sSQL += "</SESSION>" 

sSQL += "<sql:query>exec objSession_login @uid,@pwd</sql:query>" 
sSQL += "</ROOT>" 

Dim myxml As New XmlDocument 
Try 
    Using conn As SqlConnection = CustomClass.Data.SqlConnectionProvider.Create() 
     Dim cmd As SqlXmlCommand 
     cmd = New SqlXmlCommand(conn.ConnectionString & ";Provider=SQLOLEDB.1;") 
     cmd.CommandType = SqlXmlCommandType.Template 
     cmd.CommandText = sSQL 
     Dim paramUid As SqlXmlParameter = cmd.CreateParameter() 
     paramUid.Name = "@uid" 
     paramUid.Value = username 
     Dim paramPwd As SqlXmlParameter = cmd.CreateParameter() 
     paramPwd.Name = "@pwd" 
     paramPwd.Value = password 
     Dim oXR As XmlReader = cmd.ExecuteXmlReader() ' Problem is here 
     myxml.Load(oXR) 
    End Using 

    strXSLFile = "xsl/Dialogue.login.xsl" 
    Dim mytransform As New XslTransform 
    Dim myreader As XmlReader 
    Dim myresolver As XmlResolver 

    Dim xpDoc As New XPathDocument(New XmlNodeReader(myxml)) 

    mytransform.Load(Current.Request.PhysicalApplicationPath & strXSLFile) 
    myreader = mytransform.Transform(xpDoc, Nothing, myresolver) 

    myxml.Load(myreader) 
    mytransform = Nothing 
    myreader = Nothing 
    myresolver = Nothing 
    xpDoc = Nothing 

    xmlloaddoc = myxml 

Catch ex As Exception 
    LogWriter.CriticalError(ex, "User Login - Exception Thrown: " & ex.Message) 
    Err.Raise(Number:=Err.Number, Description:=ex.StackTrace) 
End Try 

被拋出異常的具體線路是:昏暗OXR作爲的XmlReader = CMD .ExecuteXmlReader()

的日誌信息顯示下面的例外:

異常#1:

用戶登錄 - 異常拋出:必須將SQLOLEDB或SQLNCLI指定爲數據提供者。「 Microsoft.Data.SqlXml.SqlXmlException:必須將SQLOLEDB或SQLNCLI指定爲數據提供者。 ---> System.Runtime.InteropServices.COMException:必須將SQLOLEDB或SQLNCLI指定爲數據提供者。在Microsoft.Data.SqlXml.Common.UnsafeNativeMethods.ISQLXMLCommandManagedInterface.ExecuteToOutputStream()在Microsoft.Data.SqlXml.SqlXmlCommand.innerExecute(流strm)---結束內部異常堆棧跟蹤---在Microsoft.Data.SqlXml.SqlXmlCommand .ExecuteStream()在Microsoft.Data.SqlXml.SqlXmlCommand.ExecuteXmlReader()在dialogue.login.UserLogin(字符串username,字符串密碼,字符串郎)

異常#2:

「用戶登錄 - 異常拋出:異常來自HRESULT:0x80040E14「 Microsoft.Data.SqlXml.SqlXmlException:從HRESULT異常:0x80040E14 ---> System.Runtime.InteropServices.COMException :從HRESULT異常:0x80040E14在Microsoft.Data.SqlXml.Common.UnsafeNativeMethods.ISQLXMLCommandManagedInterface.ExecuteToOutputStream()在Microsoft.Data.SqlXml.SqlXmlCommand.innerExecute(流strm)---結束內部異常堆棧跟蹤---在微軟.Data.SqlXml.SqlXmlCommand.ExecuteStream()在Microsoft.Data.SqlXml.SqlXmlCommand.ExecuteXmlReader()在dialogue.login.UserLogin(字符串username,字符串密碼,字符串郎)

第一例外的是第一個使用SQLOLEDB.1作爲我的提供者的錯誤,我開始玩弄不同的提供者並得到第二個異常。

任何想法?

回答

1

我遇到的這個問題是,我的機器上安裝了MSXML 6.0,但沒有安裝服務器。在服務器上安裝MSXML 6.0可解決此問題。

0

SQLOLEDB提供程序是否安裝在目標機器上?檢查一下,然後重試。

+0

是的,它是目前安裝在我們的服務器上,我們正在使用IIS6.0,問題仍然存在。 – Brandon

相關問題