System.Web.Hosting

C

Ching-Lung

Hi,

*********
MyHost.cs
*********
using System;
using System.IO;
using System.Web;
using System.Web.Hosting;
using System.Diagnostics;

public class MyHost : MarshalByRefObject
{
public void CreateHtmlPage(string webPage, string
query, string file)
{
StreamWriter stream = new StreamWriter(file);
SimpleWorkerRequest swr = new SimpleWorkerRequest
(webPage, query, stream);
HttpRuntime.ProcessRequest(swr);
stream.Close();
}
}

********
Form1.cs
********
I am getting the following error message:
An unhandled exception of
type 'System.IO.FileNotFoundException' occurred in
mscorlib.dll

on line:
host = (MyHost)ApplicationHost.CreateApplicationHost
(typeof(MyHost), "/foo", Environment.CurrentDirectory);


Which file is it trying to open? Please help.

Thanks.
 
X

Xin Huang

You need to put a copy of the MyHost assembly into .\bin directory. This
behavior is by design. ASP.NET loads its dependencies from the .\bin
folder. Also you can put the MyHost class to a separate DLL and register it
to the GAC.

Regards,
Xin

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. (c) 2003 Microsoft Corporation. All
rights reserved.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top