1
突然之间所有的呼叫到我的Web服务得到这个错误:Web服务返回XML错误
2010-11-04 17:42:16,321 [9] ERROR ABCKiosk - System.InvalidOperationException: Response is not well-formed XML. ---> System.Xml.XmlException: Data at the root level is invalid. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
at System.Xml.XmlReader.MoveToContent()
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
--- End of inner exception stack trace ---
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at ABCKiosk.WebServices.Services.ActivityLog(String kioskID, String KTID, String activityType, Int32 errorCodeFromIncentOne, String msgFromIncentOne, DateTime kioskTime) in D:\SMS SHANE\KIOSK\ABCNC_Kiosk\Implementation\Source Code\ABCKioskClient\ABCKiosk\Web References\WebServices\Reference.cs:line 121
at ABCKiosk.FrmMain.FrmMain_KeyUp(Object sender, KeyEventArgs e) in D:\SMS SHANE\KIOSK\ABCNC_Kiosk\Implementation\Source Code\ABCKioskClient\ABCKiosk\FrmMain.cs:line 110
之前每名被罚款:(有谁知道问题出在哪里,以及如何解决这个
?非常感谢
更新 - 提供更多信息
这里是我的一个Web方法:
[WebMethod(EnableSession = true)]
public CommonResult ActivityLog(string kioskID, string KTID,
string activityType, int errorCodeFromIncentOne, string msgFromIncentOne, DateTime kioskTime)
{
XMLParser parser = new XMLParser(Server.MapPath(Constant.XML_CONFIGURATION_FILE_PATH));
CommonResult result = new CommonResult();
try
{
AccountDAO accountDAO = new AccountDAO();
ActivityLogDAO activityLogDAO = new ActivityLogDAO();
KioskDAO kioskDAO = new KioskDAO();
// check if this kiosk is existed
if (!kioskDAO.IsKioskIDExisted(kioskID))
{
result.ErrorCode = Constant.ERROR_CODE_KIOSKID_NOT_EXISTED;
result.Message = "abc";
return result;
}
// check if this KTID is existed
if (!accountDAO.IsKTIDExisted(KTID))
{
result.ErrorCode = Constant.ERROR_CODE_KTID;
result.Message = "abc";
return result;
}
// check if this customer already logged for today
if (activityLogDAO.IsLoggedForToday(KTID, DateTime.Now))
{
result.ErrorCode = Constant.ERROR_CODE_LOG_LIMIT;
result.Message = "abc";
return result;
}
// begin log this activity to database
activityLogDAO.ActivityLog(KTID, kioskID, kioskTime);
// return success
result.ErrorCode = Constant.ERROR_CODE_SUCCESS;
result.Message = "abc";
return result;
}
catch (Exception e)
{
result.ErrorCode = Constant.ERROR_CODE_SYSTEM_ERROR;
result.Message = "abc";
return result;
}
}
UPDATE
我试图运行将WebMethod当地视察返回页面,看到这个页面的源:
<b> Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
<br><br>
<b> Exception Details: </b>System.InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/ActivityLog'.<br><br>
<b>Source Error:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code>
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code>
</td>
</tr>
</table>
<br>
<b>Stack Trace:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr>
<td>
<code><pre>
[InvalidOperationException: Request format is unrecognized for URL unexpectedly ending in '/ActivityLog'.]
System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +405913
System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +212
System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +47
System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +193
System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +93
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
</pre></code>
也许一些序列化步骤刚刚坏了?不要发布更多关于数据发送来回的信息,甚至可能还有一个http提要日志。 – CodingBarfield 2010-11-04 15:37:47
我怎样才能得到一个http提要日志?我对.Net网络编程相当陌生 – Leo 2010-11-05 02:02:27