.EXE.CONFIG for an IIS deployed EXE

I'm trying to get an application to run from the address bar.

The application is running fine, it's just failing when it attempts to read the .exe.config file which contains some vital settings for the app.

The exception I'm getting is a WebException with the error "The remote server returned an error: (403) Forbidden."

From log information I can see that it is attempting to load the .exe.config file I believe IIS is refusing the request, returning an error.

I suspect the issue here is that .config's are not something thats normally read.... most ASP.Net people would probably regard it as a pretty major security flaw if it could be.

Before I go and create a work around.... turn my .config into a xml and parse it manually...

Is there some trick here ?

Has anyone found a way to get a .exe.config file processed normally when the applicaiton is deployed from IIS ?

[901 byte] By [codefund.com] at [2008-2-23]
# 1
I came across an article that might help... the url is:

http://www.ondotnet.com/lpt/a/3154

The title is "Distributed .config Files with Smart Clients", by Chris Sells.

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...
# 2
Yep, there is a solution for your problem....

It's so simple, and i lost so much time trying to solve it....

THe problem is that IIS simply refuses access to .config files, no matter if the are web.config or exe.config.

The solution is to remove this behaviour from the folder where your application exe is.

Go to IIS, and get properties of the folder your application is, then u must probably have it configured as an application if not click on the button Create, make sure execute permissions are Scripts only. then click on the button configure and on the mappings search for .config and click on remove.

This will allow your .config file to be allowed read access.....

Leandro Teixeira

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...
# 3
Even simpler, no mapping removals required. just create a web.config in the folder where your exe and config file are located (assuming this is a sub folder of your site). It will allow your config file ONLY to be downloaded (i.e. no other .config files). I've assumed your config file is called myapp.exe.config but change as required.

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

<configuration>
<system.web>
<httpHandlers>
<add verb="GET" path="myapp.exe.config" type="System.Web.StaticFileHandler" />
</httpHandlers>
</system.web>
</configuration>

Hope this helps

Mark

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,ClickOnce and Setup & Deployment Projects...