[英]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.