hackpin
asked on
Why is it whenever I use System.Web.Hosting.ApplicationHost.CreateApplicationHost it always returns System.IO.FileNotFoundException?
I'm trying to host asp.net application and asp web services without IIS. I found the cassini web project and other tutorial around the net. All of them are using the CreateApplicationHost from System.Web.Hosting.Applica tionHost namespace. I copied some code from those project and build it properly but whenever I tried to run it on debug I always get the file not found error. I think it is caused by the Virtual Directory path but don't know how to fix it.
public class MySimpleHost : MarshalByRefObject
{
public void ProcessRequest(string page, string query, TextWriter tw)
{
SimpleWorkerRequest swr =
new SimpleWorkerRequest(page, query, tw);
HttpRuntime.ProcessRequest(swr);
}
}
namespace SimpleHost
{
class Program
{
static void Main(string[] args)
{
string dir = System.IO.Directory.GetCurrentDirectory();
MySimpleHost msh = (MySimpleHost)ApplicationHost.CreateApplicationHost(
typeof(MySimpleHost), "/", dir);
}
}
ASKER
I compiled the projects Dhaest mention above properly unfortunately I encountered the same problem the System.io.filenotfound exception. What I wanted to do is to make my own hosting application rather than using the code on code project. I want to make it from scratch for me to understand it well.
I looked on my bin folder and the exe file is already created for me after my build. Can anyone point me out what am I missing?
I looked on my bin folder and the exe file is already created for me after my build. Can anyone point me out what am I missing?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.codeproject.com/KB/dotnet/usingaspruntime.aspx
Another thread about it
http://forums.asp.net/rss.aspx?ForumID=67&PostID=771470