我已经实现了一个web服务(Classic .Net服务,而不是WCF)来加载数据并返回给用户控件。此user服务是从我创建的用户控件中调用的。但是,当我尝试使用web服务读取文件时,收到的是一个错误,而不是字节数组。就像以前一样,所有的东西在我的本地机器上都能完美地工作,而在开发和升级环境中,所有的地狱都被打破了。作为测试的一部分,我还更改了web服务以返回一个简单的字节数组,这似乎在所有三个实例中都工作得很好,验证了web服务是否按预期工作。下面复制的是错误和返回此错误的web服务的代码。
有什么想法吗?
注意: webmethod是通过传入文件在服务器上的绝对路径而不是相对路径来调用的。
错误:
网页错误详细信息
User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; MDDR; .NET4.0C)
Timestamp: Thu, 13 Jan 2011 04:29:30 UTC
Message: System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.IO.IOException: The device is not ready.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at TXTextControl.LoadSettings.?(String A_0, StreamType A_1, ? A_2, ? A_3)
at TXTextControl.ServerTextControl.Load(String path, StreamType streamType)
at DocumentManager.DocumentService.Document.Load(String documentLocation) in C:\Webs\AR\DocumentManager\DocumentManager\Document.asmx.vb:line 21
--- End of inner exception stack trace ---
Line: 23
Char: 13
Code: 0代码:
<WebMethod()> _
Public Function Load(ByVal documentLocation As String) As Byte()
Dim serverTextControl As New TXTextControl.ServerTextControl()
Dim documentData As Byte() = Nothing
Dim docLocation As String = Server.UrlDecode(documentLocation)
serverTextControl.Create()
'serverTextControl.Text = "This document has been loaded from the server " & System.DateTime.Now
serverTextControl.Load(docLocation, textControlUtility.computeStreamType(documentLocation))
serverTextControl.Save(documentData, TXTextControl.BinaryStreamType.InternalUnicodeFormat)
serverTextControl.Dispose()
Return documentData
End Function发布于 2011-01-14 02:55:47
听起来你发送的是一个无效的路径。因为错误来自System.IO.IOException。
https://stackoverflow.com/questions/4683519
复制相似问题