简体   繁体   English

Log4Net:创建“ system.net/defaultproxy”配置部分中指定的Web代理时出错

[英]Log4Net : Error creating the web proxy specified in the 'system.net/defaultproxy' configuration section

I have a very strange error : 我有一个非常奇怪的错误:

In my web config I have : 在我的网络配置中,我有:

<system.diagnostics>
    <trace autoflush="true">
      <listeners>
        <add name="textWriterTraceListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\tmp\log4net.txt" />
      </listeners>
    </trace>

So when I try to connect www.google.com (for example) by my code. 因此,当我尝试通过我的代码连接www.google.com(例如)时。 I have the error : 我有错误:

Error creating the web proxy specified in the 'system.net/defaultproxy' configuration section

if I remove the tmp from my path to have : 如果我从路径中删除tmp以拥有:

<system.diagnostics>
    <trace autoflush="true">
      <listeners>
        <add name="textWriterTraceListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\log4net.txt" />
      </listeners>
    </trace>

All works fine. 一切正常。

Strange isn't it ? 是不是很奇怪

Someone has an idea ? 有人有主意吗?

I found, 我发现,

I think it's a bug in IIS. 我认为这是IIS中的错误。

The problem was I have my website hosted on IIS, in this website, I have an application for my WebServices. 问题是我的网站托管在IIS上,在这个网站上,我有一个用于WebServices的应用程序。

My website and my webservices have their own web.config. 我的网站和Web服务都有自己的web.config。

BUT the listener name was the same on the 2 web.config, so when the value was different, i had the problem above. 但是侦听器名称在2 web.config上是相同的,所以当值不同时,我遇到了上面的问题。

So to fix it i change the name of the listener : 所以要解决它,我更改了侦听器的名称:

<system.diagnostics>
    <trace autoflush="true">
      <listeners>
        <add name="textWriterTraceListener2" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\tmp\log4net.txt" />
      </listeners>
    </trace>

name="textWriterTraceListener2" for the webservice and name="textWriterTraceListener" for the website. Web服务的名称=“ textWriterTraceListener2”,网站的名称=“ textWriterTraceListener”。

But the better is to separate them on IIS (I will do this later) Thanks, everybody for your help. 但是更好的方法是在IIS上将它们分开(我稍后会做)。谢谢大家的帮助。

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

相关问题 创建“ system.net/defaultProxy”配置部分中指定的Web代理时出错 - Error creating the Web Proxy specified in the 'system.net/defaultProxy' configuration section 创建“ system.net/defaultproxy”配置部分中指定的Web代理时出错 - error creating the web proxy specified in the 'system.net/defaultproxy' configuration section 如何从web.config的system.net部分读取defaultProxy设置的值? - How can I read the values of the defaultProxy settings from the system.net section in a web.config? 无法识别的配置部分 system.net - Unrecognized configuration section system.net 无法识别的配置节 system.net (.NET 6/.NET Core) - Unrecognized configuration section system.net (.NET 6/.NET Core) Web作业中的Log4net:无法识别的配置部分log4net-但我的configSections在顶部 - Log4net in web job: unrecognized configuration section log4net - but I have configSections in top log4net:ERROR找不到配置节“log4net” - log4net:ERROR Failed to find configuration section 'log4net' Log4Net错误:“未能找到配置节log4net” AdoNetAppender - Log4Net error : “Failed to find configuration section log4net” AdoNetAppender Log4Net 错误:“找不到配置部分 log4net” - Log4Net error : "Failed to find configuration section log4net" 无法识别的配置部分 log4net - Unrecognized configuration section log4net
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM