我已经实现了一个Web服务(Classic .Net服务,而不是WCF),以加载数据并返回到用户控件。从我创建的用户控件调用此Web服务。但是,当我尝试使用Web服务读取文件时,我收到错误而不是字节数组。和以前一样,所有这些都完全适用于我的本地机器,并且所有地狱都在开发中完全消失了。分段环境。作为我的测试的一部分,我还更改了Web服务以返回一个简单的字节数组,这似乎在所有三个实例中都正常工作,验证webservice是否按预期工作。下面复制的是错误和Web服务中返回此错误的代码。
有什么想法?
注意:通过传入服务器上文件的绝对路径而不是相对路径来调用web方法。
ERROR:
网页错误详情
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
CODE:
<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
答案 0 :(得分:0)
听起来你发送的是无效路径。由于错误来自System.IO.IOException。