简体   繁体   English

缺少方法异常单声道

[英]Missing Method exception mono

I want to execute my C# app, compiled in Windows, on my Ubuntu Server. 我想在我的Ubuntu服务器上执行我在Windows上编译的C#应用​​程序。

I am using the .Net Framework version 4.5 (can't change it cause of some 3rd party api's). 我正在使用.Net Framework 4.5版(不能改变它的一些第三方api的原因)。

I have the most actual Mono version (2.10.8) for Ubuntu installed. 我安装了Ubuntu最实用的Mono版本(2.10.8)。 My Application is compiled with VisualStudio 2012 on the Windows OS (7). 我的应用程序是在Windows操作系统(7)上使用VisualStudio 2012编译的。

I am trying to make some Post requests to other websites and parse data. 我正在尝试向其他网站发布一些Post请求并解析数据。 Here is the code which creates the Requests (which works on windows perfectly): 这是创建请求的代码(完美地适用于Windows):

HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri.AbsoluteUri);

req.UserAgent = this.UserAgent;
req.CookieContainer = this.Cookies;
req.Referer = this.Location;
req.Host = uri.Host;
req.AllowAutoRedirect = false;

And the error i am getting from Mono comes here: 我从Mono得到的错误来到这里:

Unhandled Exception: System.MissingMethodException: Method not found: 'System.Net.HttpWebRequest.set_Date'.
  at manager.http.HttpBrowser.GetPostWebRequest (System.String url, System.Collections.Generic.Dictionary`2 postdata, System.Collections.Generic.Dictionary`2 headers) [0x00000] in <filename unknown>:0
  at manager.http.HttpBrowser.Post (System.String url, System.Collections.Generic.Dictionary`2 postdata, System.Collections.Generic.Dictionary`2 headers) [0x00000] in <filename unknown>:0
  at manager.http.HttpBrowser.Post (System.String url, System.Collections.Generic.Dictionary`2 postdata) [0x00000] in <filename unknown>:0
  at manager.networks.components.MyClass.MyMethod() [0x00000] in <filename unknown>:0
  at manager.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.MissingMethodException: Method not found: 'System.Net.HttpWebRequest.set_Date'.
  at manager.http.HttpBrowser.GetPostWebRequest (System.String url, System.Collections.Generic.Dictionary`2 postdata, System.Collections.Generic.Dictionary`2 headers) [0x00000] in <filename unknown>:0
  at manager.http.HttpBrowser.Post (System.String url, System.Collections.Generic.Dictionary`2 postdata, System.Collections.Generic.Dictionary`2 headers) [0x00000] in <filename unknown>:0
  at manager.http.HttpBrowser.Post (System.String url, System.Collections.Generic.Dictionary`2 postdata) [0x00000] in <filename unknown>:0
  at manager.networks.components.MyClass.MyMethod() [0x00000] in <filename unknown>:0
  at manager.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0

I googled for 2 days now and can't find a solution. 我用谷歌搜索了2天,找不到解决方案。 :( :(

UPDATE: 更新:

The attributes set_Date AND set_host are currently not Implemented at Mono. 属性set_Date和set_host当前未在Mono中实现。 (I upgraded my Version to 3.x) (我将我的版本升级到3.x)

.NET 4.5 is not supported in Mono 2.x, upgrade to Mono 3.x. Mono 2.x不支持.NET 4.5,升级到Mono 3.x.

You have a guide here: Installing Mono 3.x in Ubuntu/Debian 你有一个指南: 在Ubuntu / Debian中安装Mono 3.x.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM