I have been getting an error when moving my application from my local machine to a web server. (I have not been getting the errors on my local host)
The code throwing the exception is listed below:
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
The specific Line that is throwing the exception is : Dim oXR As XmlReader = cmd.ExecuteXmlReader()
The logging information revealed the exceptions below:
Exception #1:
User Login – Exception Thrown: SQLOLEDB or SQLNCLI must be specified as the data provider.”
Microsoft.Data.SqlXml.SqlXmlException: SQLOLEDB or SQLNCLI must be specified as the data provider. —> System.Runtime.InteropServices.COMException: SQLOLEDB or SQLNCLI must be specified as the data provider. at Microsoft.Data.SqlXml.Common.UnsafeNativeMethods.ISQLXMLCommandManagedInterface.ExecuteToOutputStream() at Microsoft.Data.SqlXml.SqlXmlCommand.innerExecute(Stream strm) — End of inner exception stack trace — at Microsoft.Data.SqlXml.SqlXmlCommand.ExecuteStream() at Microsoft.Data.SqlXml.SqlXmlCommand.ExecuteXmlReader() at dialogue.login.UserLogin(String username, String password, String lang)
Exception #2:
“User Login – Exception Thrown: Exception from HRESULT: 0x80040E14”
Microsoft.Data.SqlXml.SqlXmlException: Exception from HRESULT: 0x80040E14 —> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80040E14 at Microsoft.Data.SqlXml.Common.UnsafeNativeMethods.ISQLXMLCommandManagedInterface.ExecuteToOutputStream() at Microsoft.Data.SqlXml.SqlXmlCommand.innerExecute(Stream strm) — End of inner exception stack trace — at Microsoft.Data.SqlXml.SqlXmlCommand.ExecuteStream() at Microsoft.Data.SqlXml.SqlXmlCommand.ExecuteXmlReader() at dialogue.login.UserLogin(String username, String password, String lang)
The first of the exceptions is the first error that came up using SQLOLEDB.1 as my provider, I started playing around with different providers and got the second 2nd exception.
Any ideas?
This problem that I had was, MSXML 6.0 was installed on my machine but not the server. Installing MSXML 6.0 on the server resolved this issue.