Asp.net mvc 2 Silverlight 4、Google Chrome和HttpWebRequest问题

Asp.net mvc 2 Silverlight 4、Google Chrome和HttpWebRequest问题,asp.net-mvc-2,google-chrome,httpwebrequest,silverlight-4.0,Asp.net Mvc 2,Google Chrome,Httpwebrequest,Silverlight 4.0,我的Silverlight 4应用程序托管在ASP.NET MVC 2中,通过Internet Explorer 8在开发服务器和远程web服务器(IIS 6.0)中使用时运行良好。然而,当我尝试浏览Google Chrome(5.0.375.70版)时,它抛出了“远程服务器返回未找到”错误。导致问题的代码如下所示: public class MyWebClient { private HttpWebRequest _request; private Uri _uri; privat

我的Silverlight 4应用程序托管在ASP.NET MVC 2中,通过Internet Explorer 8在开发服务器和远程web服务器(IIS 6.0)中使用时运行良好。然而,当我尝试浏览Google Chrome(5.0.375.70版)时,它抛出了“远程服务器返回未找到”错误。导致问题的代码如下所示:

public class MyWebClient
{
  private HttpWebRequest _request;
  private Uri _uri;
  private AsyncOperation _asyncOp;

  public MyWebClient(Uri uri)
  { 
    _uri = uri; 
  }

  public void Start(XElement data)
  {
    _asyncOp = AsyncOperationManager.CreateOperation(null);
    _data = data;
    _request = (HttpWebRequest)WebRequest.Create(_uri);
    _request.Method = "POST";
    _request.BeginGetRequestStream(new AsyncCallback(BeginRequest), null);
  }

  private void BeginRequest(IAsyncResult result)
  {
    Stream stream = _request.EndGetRequestStream(result);
    using (StreamWriter writer = new StreamWriter(stream))
    {
      writer.Write(((XElement)_data).ToString());
    }
    stream.Close();
    _request.BeginGetResponse(new AsyncCallback(BeginResponse), null);
  }

  private void BeginResponse(IAsyncResult result)
  {
    HttpWebResponse response = (HttpWebResponse)_request.EndGetResponse(result);
    if (response != null)
    {
       //process returned data
        ...
    }
  }
  ...
 }

简而言之,上面的代码将一些XML数据发送到web服务器(到ASP.NET MVC控制器),并返回处理后的数据。当我使用InternetExplorer8时,它可以工作。有人能解释一下Google Chrome有什么问题吗?

我发现问题与使用Google Chrome处理ASP.NET MVC路由有关,因此提出了一个新问题:


您是否查看了IIS日志,以检查Chrome的URI和参数是否正确?IE有自动编码HTML参数的好习惯。我不知道Chrome是否做到了(Firefox没有)。我检查了日志文件:Chrome:2010-06-15 01:45:39 W3SVC1452470319 10.1.1.22 POST/AppServices/ProcessData-80-10.1.12.74 Mozilla/5.0+(Windows;+U;+Windows+NT+5.1;+en-US)+AppleWebKit/533.4+(KHTML,+like+Gecko)+Chrome/5.0.375.70+Safari/533.4 500 0 IE:2010-06-15 01:48:14 W3SVC1452470319 10.1.1.22 POST/AppServices/ProcessData-80-10.1.12.74 Mozilla/4.0+(兼容;+MSIE+7.0;+Windows+NT+5.1;+Trident/4.0;+NET+CLR+2.0.50727;+NET+CLR+3.0.4506.2152;+NET+CLR+3.5.30729;+NET4.0C;+NET4.0.0)有任何提示吗?