我在其中一台MacBook上遇到了很奇怪的问题。我有一个在Mono上运行的C#应用程序。该应用程序通过HTTP与Web服务通信,在我的旧MacBook上完美运行。
我买了一台新的Macbook,并测试了我的应用程序,但由于某种奇怪的原因:
HttpWebRequest myReq =
(HttpWebRequest)WebRequest.Create(sURI);
将提供的URI作为异常消息,抛出NotSupportedException
。
我还尝试了以下内容:
HttpWebRequest myReq =
(HttpWebRequest)WebRequest.Create("http://www.google.com");
我遇到了同样的异常。我不确定为什么会出现这种情况,也想不出任何可能导致这种情况的原因,因为在其他 Mac 上似乎完美运行。
编辑:
我使用的 Mono 版本是 2.10.11
异常的堆栈跟踪如下:
Webrequest.Create Exception string : System.NotSupportedException: http://www.google.com/
at System.Net.WebRequest.GetCreator (System.String prefix) [0x00000] in <filename unknown>:0
at System.Net.WebRequest.Create (System.Uri requestUri) [0x00000] in <filename unknown>:0
at System.Net.WebRequest.Create (System.String requestUriString) [0x00000] in <filename unknown>:0
at MyApp.XSPManager.GeneralSOAPFunction (System.String serverName, System.String settingsAsXml, SharedLib.zErrorCodes& errorCode, System.String& message, System.String& actionType) [0x00000] in <filename unknown>:0
敬礼