401 Unauthorized (WebException) & Failed Connection Attempt (SocketException)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

401 Unauthorized (WebException) & Failed Connection Attempt (SocketException)

Guest-854

Thanks for the utility Dean!  I have successfully set this up in a .NET 2.0 project and it works great, but only locally.  When I deploy to another server I am getting errors on both that are different.  The IIS version is 6.0 and the file sizes being used are < 300K each.

The "upload" directory on both servers has READ & WRITE permissions allowed for LOCAL SERVICE, NETWORK SERVICE, and ANONYMOUS LOGON.

This configuration works perfect locally running on IIS 7 instance both running from within Visual Studio as well as setting up as an application.

Any help or feedback will be greatly appreciated.  Version number is 1.3.

Server Error in '/' Application.

The remote server returned an error: (401) Unauthorized.

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 remote server returned an error: (401) Unauthorized.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[WebException: The remote server returned an error: (401) Unauthorized.]
            System.Net.WebClient.UploadValues(Uri address, String method, NameValueCollection data) +480
            System.Net.WebClient.UploadValues(String address, NameValueCollection data) +34
            Brettle.Web.NeatUpload.SimpleWebRemoting.MakeRemoteCall(Uri uri, HttpCookieCollection httpCookies, Byte[] encryptionKey, Byte[] validationKey, String encryptionAlgorithm, String validationAlgorithm, Object[] methodCall) +1280
            Brettle.Web.NeatUpload.SimpleWebRemoting.MakeRemoteCall(Uri uri, Object[] methodCall) +177
            Brettle.Web.NeatUpload.SessionBasedUploadStateStoreProvider.MakeRemoteCall(Object[] methodCall) +185
            Brettle.Web.NeatUpload.SessionBasedUploadStateStoreProvider.Load(String postBackID) +172
            Brettle.Web.NeatUpload.UploadStateStore.OpenReadWrite(String postBackID) +65
            Brettle.Web.NeatUpload.UploadStateStore.OpenReadWriteOrCreate(String postBackID) +49
            Brettle.Web.NeatUpload.Internal.Module.FilteringWorkerRequest.ParseOrThrow() +4528
            Brettle.Web.NeatUpload.Internal.Module.FilteringWorkerRequest.ParseMultipart() +1875
            Brettle.Web.NeatUpload.UploadHttpModule.WaitForUploadToComplete() +87
            Brettle.Web.NeatUpload.UploadHttpModule.Application_ResolveRequestCache(Object sender, EventArgs e) +138
            System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
            System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
            


Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

The other Exception:

Server Error in '/IngestWizard' Application.

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond SERVER_IP_ADDRESS:80

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.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond SERVER_IP_ADDRESS:80

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SocketException (0x274c): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 216.182.90.71:80]
            System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +239
            System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +35
            System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +224
            [WebException: Unable to connect to the remote server]
            System.Net.WebClient.UploadValues(Uri address, String method, NameValueCollection data) +480
            System.Net.WebClient.UploadValues(String address, NameValueCollection data) +34
            Brettle.Web.NeatUpload.SimpleWebRemoting.MakeRemoteCall(Uri uri, HttpCookieCollection httpCookies, Byte[] encryptionKey, Byte[] validationKey, String encryptionAlgorithm, String validationAlgorithm, Object[] methodCall) +1280
            Brettle.Web.NeatUpload.SimpleWebRemoting.MakeRemoteCall(Uri uri, Object[] methodCall) +177
            Brettle.Web.NeatUpload.SessionBasedUploadStateStoreProvider.MakeRemoteCall(Object[] methodCall) +185
            Brettle.Web.NeatUpload.SessionBasedUploadStateStoreProvider.Load(String postBackID) +172
            Brettle.Web.NeatUpload.UploadStateStore.OpenReadWrite(String postBackID) +65
            Brettle.Web.NeatUpload.UploadStateStore.OpenReadWriteOrCreate(String postBackID) +49
            Brettle.Web.NeatUpload.Internal.Module.FilteringWorkerRequest.ParseOrThrow() +4522
            Brettle.Web.NeatUpload.Internal.Module.FilteringWorkerRequest.ParseMultipart() +1875
            Brettle.Web.NeatUpload.UploadHttpModule.WaitForUploadToComplete() +87
            Brettle.Web.NeatUpload.UploadHttpModule.Application_ResolveRequestCache(Object sender, EventArgs e) +138
            System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
            System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
            


Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

Here is the web.config being used for both applications. I have not included the appSettings as they are specific to the application and have nothing to do with NeatUpload configuration.

<?xml version="1.0" encoding="UTF-8"?>

<configuration>
<
configSections>
<
section name="neatUpload" type="Brettle.Web.NeatUpload.ConfigSectionHandler, Brettle.Web.NeatUpload" allowLocation="true" />
</
configSections>
<
appSettings>
<!--
site app settings here -->
</
appSettings>

<connectionStrings />

<!-- neat upload -->

<neatUpload xmlns="http://www.brettle.com/neatupload/config/2008"
useHttpModule="true"
maxNormalRequestLength="2097151"
maxRequestLength="2097151"
defaultStorageProvider="FilesystemUploadStorageProvider"
defaultStateStoreProvider="SessionBasedUploadStateStoreProvider">

 

 

 

 

<providers>
<
add name="FilesystemUploadStorageProvider" type="Brettle.Web.NeatUpload.FilesystemUploadStorageProvider, Brettle.Web.NeatUpload" tempDirectory="upload" />
<
add name="SessionBasedUploadStateStoreProvider" type="Brettle.Web.NeatUpload.SessionBasedUploadStateStoreProvider, Brettle.Web.NeatUpload"/>
</
providers>
</
neatUpload>

<location path="Default.aspx">

<system.web>
<
httpRuntime maxRequestLength="2097151" executionTimeout="43200" useFullyQualifiedRedirectUrl="true"/>
<
httpModules>
<
add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule, Brettle.Web.NeatUpload"/>
</
httpModules>
</
system.web>

<neatUpload maxRequestLength="2097151" useHttpModule="true" xmlns="http://www.brettle.com/neatupload/config/2008"/>
</
location>

<!-- neat upload -->

<system.web>
<
customErrors mode="Off" />
<
compilation debug="true" />
<
httpRuntime maxRequestLength="2097151" enable="true" requestLengthDiskThreshold="8192" executionTimeout="43200" />
<
sessionState timeout="720" />
<
globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="auto" uiCulture="auto" enableClientBasedCulture="true" />

<!--
neat upload -->

<httpModules>
<
add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule, Brettle.Web.NeatUpload" />
</
httpModules>

<!-- neat upload -->

</system.web>

<system.webServer>
<
modules>
<
add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule, Brettle.Web.NeatUpload" preCondition="managedHandler"/>
</
modules>

<
security>
<
requestFiltering>
<
requestLimits maxAllowedContentLength="2147483648" />
</
requestFiltering>
</
security>

</system.webServer>

</configuration>

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Reply | Threaded
Open this post in threaded view
|

Re: 401 Unauthorized (WebException) & Failed Connection Attempt (SocketException)

Dean Brettle
Administrator
That is occuring when NeatUpload tries to create an http connection back to the app that is using it. It sounds like you require some sort of authorization. If you don't need web farm/garden support, the easiest workaround is to use the InProcUploadStateStoreProvider. Search the manual for that provider for details. If you can't figure it out or do need web farm/garden support, let me know.