Reputation: 3041
I want to create a simple web service to distribute to ASP.Net developers. I found an application (SvnBridge) which has the layout I'm after - a single web.config
file and a single .dll
file.
The interesting part is in the web.config
file:
<httpHandlers>
<clear/>
<add verb="*" path="*" type="SvnBridgeServer.SvnBridgeHttpHandler, SvnBridgeServer" />
</httpHandlers>
Ooooo that looks perfect. I can throw anything I like at this and have it handled by what I presume is an IHttpHandler
implementation.
So I ripped off the spirit of the afore-linked config file, bundled my library into a DLL and hit build in VS. I immediately get this in IE:
Source Error:
[No relevant source lines]
I mainly work with PHP - ASP.Net is quite new to me. Clearly I'm doing something wrong, but I haven't a clue where even to start.
At the moment, I use a Python script to bundle all the C# source into a single .ashx
file, which is kinda cool for distribution, but makes debugging a nightmare. It looks a bit like this:
<%@ WebHandler Language="C#" Class="MyApp.MyClass" debug="true" %>
using System.Data;
...
namespace MyApp
{
public class MyClass : IHttpHandler
{
public void ProcessRequest(HttpContext Http)
{
...
}
}
}
There's obviously a lot more to it (user config area etc), but you get the gist.
Can someone point me in the right direction? I'm comfortable with the C# language, it's just the arrangement and configuration that has me a bit stumped.
I realise this question may seem somewhat ambiguous - please post comments and I'll try to clarify where necessary.
Thanks,
Neil.
Upvotes: 0
Views: 589
Reputation: 3041
This is fixed. I had to turn the folder into an application in IIS, and move the source to a trusted (non-network) location.
My gratitude for those who took the time to review this question.
Upvotes: 1
Reputation: 5128
What does the EventLog say ? There probably should be a record (of type "Warning" with the source which looks like "ASP.NET x.x.xxxxx.x").
Anyway, you mentioned in the beginning of your post that you'd like to have a single DLL-file (among with the web.config) to be distributed. Later you point to the .ashx
file.
I'd rather create a single class (.cs file within your project) and put the implementation of my HTTP handler in that class.
Also, double-check that the type of your HTTP handler is specified correctly in a web.config:
<add verb="*" path="*" type="[namespace].[type], [assembly]" />
If you're using IIS6 then you need to manually add a wildcard script mapping in order for your HTTP handler to "catch" the requests. This forum post might help.
-- Pavel
Upvotes: 1