Thursday, January 22, 2009

Errors (501, 403 and 401) while using AppUpdater for a .Net Windows Application

If the error is:
"System.Net.WebException: The remote server returned an error: (501) Not Implemented."
1) Go to IIS and click on Web Server Extentsions and then click on WebDAV and give it the
allow permissions.
2) Check the "directory browsing" checkbox for the update folder from IIS.

If the error is:
"System.Net.WebException: The remote server returned an error: (403) Forbidden."
You have to grant permission on the foll:
1) Script Source Access permission to the update folder.

If the error is:
"System.Net.WebException: The remote server returned an error: (401) Unauthorized."
Cause: Problem can be App.config which will be "ApplicationName.exe" web configuration file.

Solution: Try removing the App.config from updates folder. It should work !! :)

Removing the .config file "works" but may not be the best solution becuase .config files need to be sent as application updates at times. Here's a little theory as to why this error occurs followed by a solution: Files with extentions like .asp, .aspx, .config are treated as scripts. something which IIS is supposed to run/interpret and not just allow users to download in it's raw form. so if you visit an asp you see html returned by asp. Similary if you visit a .config using your browser you see xml output of the .config -however IIS does NOT let you download these files and in a typical web scenario there's no reason why a user should. However, in our case .config is a part of the client application we're trying to download using appupdater and not a typical web/IIS script. So, The solution? You need to do is enable "Script Source Access" on the virtual directory that's hosting your update using IIS admin! That's all you need to do :).


For further details:
Also refer link: http://social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/0b069264-167b-47a4-b312-64aa9bd4c86a/

1 comment:

Anonymous said...

Nice brief and this fill someone in on helped me alot in my college assignement. Thank you as your information.