I have deployed a website using Visual Studio 2010 on IIS6. I used one of the four methods available : the basic file copy. It’s like ordering to build to a different location, rather than the usual debug/release path in the project folder.
Anyway, the site that I released is responsive. As I have given all authorizations possible, I can browse contents, get files, most importantly execute asp/aspx pages.
I have declared the following http handler, it answers to URL/[anytext].text in debug mode (i.e. http://localhost/blablabla.text) and sends back an empty XML at the moment.
The same thing doesn’t work after I deploy.
Code of my handler :
namespace WebApplication3
{
public class HttpHandler : IHttpHandler
{
public void ProcessRequest(System.Web.HttpContext context)
{
HttpResponse objResponse = context.Response;
objResponse.ContentType = "text/plain";
objResponse.Write("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>");
objResponse.Write("</xml>");
}
public bool IsReusable
{
get
{
return true;
}
}
}
}
web.config that gets deployed at the root of my IIS virtual directory :
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation targetFramework="4.0" />
<httpHandlers>
<add verb="*" path="*.text" type="WebApplication3.HttpHandler, WebApplication3"/>
</httpHandlers>
</system.web>
</configuration>
And just if that can help, this is the web.config that I have in my VS2010 solution :
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpHandlers>
<add verb="*" path="*.text" type="WebApplication3.HttpHandler, WebApplication3"/>
</httpHandlers>
</system.web>
</configuration>
Why would that not work as well right after the release ? I guess there’s something missing. Most likely the web.config is never read ?
I finally found what this was about. The deployment process I described is fine. What you need to know, is that you need to tweak your IIS settings depending on what kind of handler your are adding.
In my case, I needed to add an extension (.text) in IIS.
http://msdn.microsoft.com/en-us/library/bb515343.aspx