asp.net - 在 Mono 中配置 System.Net 时出现问题

标签 asp.net .net mono web-config

我尝试在 Mono 项目的 Web.config 中配置 System.net 节点。

我不断收到此异常:

System.Configuration.ConfigurationErrorsException
Error deserializing configuration section defaultProxy: Unrecognized attribute 'enabled'. (/usr/share/nginx/aspnet/Web.config line 1)

Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): System.Configuration.
Exception stack trace:
  at System.Configuration.ConfigurationSection.DeserializeSection (System.Xml.XmlReader reader) [0x00000] in <filename unknown>:0 
  at System.Configuration.Configuration.GetSectionInstance (System.Configuration.SectionInfo config, Boolean createDefaultInstance) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigurationSectionCollection.get_Item (System.String name) [0x00000] in <filename unknown>:0 
  at System.Configuration.Configuration.GetSection (System.String path) [0x00000] in <filename unknown>:0 
  at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName, System.String path, System.Web.HttpContext context) [0x00000] in <filename unknown>:0 
  at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0 
  at System.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection (System.String configKey) [0x00000] in <filename unknown>:0 
  at System.Configuration.ConfigurationManager.GetSection (System.String sectionName) [0x00000] in <filename unknown>:0 
  at System.Net.WebRequest.GetDefaultWebProxy () [0x00000] in <filename unknown>:0 
  at System.Net.WebRequest.get_DefaultWebProxy () [0x00000] in <filename unknown>:0 
  at System.Net.GlobalProxySelection.get_Select () [0x00000] in <filename unknown>:0 
  at System.Net.HttpWebRequest..ctor (System.Uri uri) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Net.HttpWebRequest:.ctor (System.Uri)
  at System.Net.HttpRequestCreator.Create (System.Uri uri) [0x00000] in <filename unknown>:0 
  at System.Net.WebRequest.Create (System.Uri requestUri) [0x00000] in <filename unknown>:0 
  at System.Net.WebClient.GetWebRequest (System.Uri address) [0x00000] in <filename unknown>:0 
  at System.Net.WebClient.SetupRequest (System.Uri uri) [0x00000] in <filename unknown>:0 
  at System.Net.WebClient.OpenRead (System.Uri address) [0x00000] in <filename unknown>:0 

我不知道如何让我的应用程序接受启用属性设置为 true 的 defaultProxy 节点或使用其他一些设置。

如果我从 Web.config 中删除 System.net 节点,则应用程序中使用 WebClient 的部分会超时。

最佳答案

我相信您已经发现了 Mono 中的一个错误。 DefaultProxySection constructor seems to forget to add the attribute properties to the collection ,因此配置读取器不知道它们。

请注意,enabled 属性的默认值为 true,因此您可以忽略该设置作为解决问题的方法。

尽管如此,请在bugzilla.xamarin.com中报告该错误

关于asp.net - 在 Mono 中配置 System.Net 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18655165/

相关文章:

asp.net - 如何使用 JQuery 更改 Css 类?

c# - 一种将 xml 注释从一组 API 复制到另一组类似 API 的方法?

c# - 如果 watin 中出现对话框,如何默认使测试失败

c# - C# .net 中的这个声明是什么意思?

c# - 为什么向结构体添加一个额外的字段会大大提高其性能?

c# - 将 C# 与 MonoMac 一起使用时获取 Mac ~/Library/path 的最佳方法

asp.net - 获取 "This type of page is not served",如何在本地机器上的 Visual Studio 中运行经典 asp?

.net - Visual Studio 调试器在网站根目录下未附加

c# - 在 c# .net 中验证 Firebase JWT

asp.net - 具有不带.aspx扩展名的URL