首先,我对Linux Os和Mono也是全新的。HTTP请求验证在Ubuntu上使用Mono的ASP.NET Web服务中的异常
我已采取所有步骤从下面的帖子在Linux上运行Ubuntu的使用Mono我的Web API服务:
http://piotrwalat.net/running-asp-net-web-api-services-under-linux-and-os-x/
现在我能够从localhost:5757
运行在Ubuntu上我的Web服务,但当我执行的方法,我得到System.Web.HttpRequestValidationException
:
A potentially dangerous Request.QueryString value was detected from the client
这是我的测试方法:
[WebMethod]
public string Test(string strXML)
{
string strMessage = "";
XmlDocument xdoc = new XmlDocument();
try
{
xdoc.LoadXml(strXML);
XmlNode xContent = xdoc.GetElementsByTagName("content")[0];
strMessage = xContent.InnerText;
}
catch (Exception ex)
{
csGlobal.ErrorLog(ex.Message + " " + ex.StackTrace);
}
return strMessage;
}
这是我想测试输入的XML消息:
<data><content>some content</content></data>
它可以完美运行在IIS与Windows。但是,我如何才能在Linux上使用Mono?
UPDATE:
.NET版本是3.5,我在我的web.config文件中添加<pages validateRequest="false" />
,但仍得到相同的错误。
你建议我做什么?
谢谢你。它解决了我的情况下的问题。 – 2014-11-11 04:45:12