PDA

View Full Version : Behind a proxy server: The underlying connection was closed



Joakim Gran
04-22-2005, 01:49 PM
Hi!

I get the error pasted below when behind a proxy on a clients network.

All works fine when not connected to the netwoork. My website is running on my local machine so I don't understand why it tries to connect to a "remote server" when loading my object definitions.

I have specified a proxy server in IE LAN proxy settings that otherwise works as it should.

My context definition in web.config looks like this:
<spring>
<context type="Spring.Context.Support.WebApplicationContext,Sprin g.Web">
<resource uri="~/Config/Objects.xml" />
<resource uri="~/Config/Pages.xml" />
</context>
</spring>


I also tried to add the following settings in web.config but it doesn't help.

<system.net>
<defaultProxy>
<proxy usesystemdefault="false" bypassonlocal="false" proxyaddress = "http://our_proxy_server:80" />
</defaultProxy>
</system.net>

Anyone have a clue whats going on?

/Joakim

--------------------------------------------

The underlying connection was closed: Unable to connect to the remote server.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.WebException: The underlying connection was closed: Unable to connect to the remote server.

Source Error:

Line 268: } // if it didn't happen it'ok
Line 269: }
Line 270: doc.Load(reader);
Line 271: rootElement = doc.DocumentElement;
Line 272: }


Source File: C:\Dev\Other\Springnet\Spring.Net\src\Spring\Sprin g.Core\Objects\Factory\Xml\XmlObjectDefinitionRead er.cs Line: 270

Stack Trace:


[WebException: The underlying connection was closed: Unable to connect to the remote server.]
System.Net.HttpWebRequest.CheckFinalStatus()
System.Net.HttpWebRequest.EndGetResponse(IAsyncRes ult asyncResult)
System.Net.HttpWebRequest.GetResponse()
System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials)
System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials) +94
System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) +55
System.Xml.Schema.DtdParser.ParseDocTypeDecl()
System.Xml.Schema.DtdParser.Parse()
System.Xml.XmlTextReader.ParseDtd(XmlScanner scanner)
System.Xml.XmlTextReader.ParseTag() +1379
System.Xml.XmlTextReader.ParseRoot() +234
System.Xml.XmlTextReader.Read() +127
System.Xml.XmlValidatingReader.ReadWithCollectText Token()
System.Xml.XmlValidatingReader.Read()
System.Xml.XmlLoader.LoadCurrentNode() +157
System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) +49
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +102
System.Xml.XmlDocument.Load(XmlReader reader) +72
Spring.Objects.Factory.Xml.XmlObjectDefinitionRead er.LoadObjectDefinitions(IResource resource) in C:\Dev\Other\Springnet\Spring.Net\src\Spring\Sprin g.Core\Objects\Factory\Xml\XmlObjectDefinitionRead er.cs:270
Spring.Context.Support.AbstractXmlApplicationConte xt.LoadObjectDefinitions(XmlObjectDefinitionReader objectDefinitionReader) in C:\Dev\Other\Springnet\Spring.Net\src\Spring\Sprin g.Core\Context\Support\AbstractXmlApplicationConte xt.cs:160
Spring.Context.Support.AbstractXmlApplicationConte xt.RefreshObjectFactory() in C:\Dev\Other\Springnet\Spring.Net\src\Spring\Sprin g.Core\Context\Support\AbstractXmlApplicationConte xt.cs:101
Spring.Context.Support.AbstractApplicationContext. Refresh() in C:\Dev\Other\Springnet\Spring.Net\src\Spring\Sprin g.Core\Context\Support\AbstractApplicationContext. cs:414
Spring.Context.Support.WebApplicationContext..ctor (String[] configurationLocations) in C:\Dev\Other\Springnet\Spring.Net\src\Spring\Sprin g.Web\Context\Support\WebApplicationContext.cs:72

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.Reflection.RuntimeConstructorInfo.InternalI nvoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean isBinderDefault) +0
System.Reflection.RuntimeConstructorInfo.Invoke(Bi ndingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +413
System.Reflection.ConstructorInfo.Invoke(Object[] parameters) +14
Spring.Objects.ObjectUtils.InstantiateType(Constru ctorInfo constructor, Object[] arguments) in C:\Dev\Other\Springnet\Spring.Net\src\Spring\Sprin g.Core\Objects\ObjectUtils.cs:109

[FatalObjectException: Could not instantiate type [Void .ctor(System.String[])]; is it an interface or an abstract class? Does it have a no-arg constructor?]
Spring.Web.Support.PageHandlerFactory.GetHandler(H ttpContext context, String requestType, String url, String path) in C:\Dev\Other\Springnet\Spring.Net\src\Spring\Sprin g.Web\Web\Support\PageHandlerFactory.cs:63
System.Web.HttpApplication.MapHttpHandler(HttpCont ext context, String requestType, String path, String pathTranslated, Boolean useAppConfig)
System.Web.MapHandlerExecutionStep.System.Web.Http Application+IExecutionStep.Execute()
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously)

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032

Rick Evans
04-22-2005, 02:43 PM
Hi Joakim

The XML parser that is parsing your object definitions is attempting to download the Spring.NET DTD from the Spring.NET homepage.

Workarounds? Don't put a DTD declaration in your config file (s); I know, you're thinking '...but, I haven't'. One of the release prior to the RC3 release contained a hack that (helpfully) inserted the DTD if it was missing. The recent Spring.NET RC3 uses XmlSchema instead of DTD based validation, and removes the (helpful) hack. If you can, try upgrading to this version... if the error still persists, then well, just hit the 'Post Reply' button on this forum and we'll have another crack at it.

Ciao
Rick

Joakim Gran
04-22-2005, 10:08 PM
Yes! I do find a DTD reference inserted in each of my object configuration files!

I'll give it a try again on monday! :D

Thanx
/Joakim