Posted By: erik_ | May 27th, 2007 @ 3:03 PM
page 1 of 1
Comments: 4 | Views: 4859
erik_
erik_
Tablet Power
Hi I am trying to use SimpleWorkerRequest, but I keep getting errors.

I currently have the following code:

StringWriter sw = new StringWriter();
SimpleWorkerRequest swr = new SimpleWorkerRequest("/test", @"c:\test\", "/test/Test.aspx", string.Empty, sw);
HttpRuntime.ProcessRequest(swr);
Console.Write(sw.GetStringBuilder().ToString());
Console.Read();

But for some reason I keep getting the following error:

[HttpException (0x80070057): Invalid file name for file monitoring: ''. Common reasons for failure include:

- The filename is not a valid Win32 file name.
- The filename is not an absolute path.
- The filename contains wildcard characters.
- The file specified is a directory.
- Access denied.

at System.Web.FileChangesMonitor.StartMonitoringFile(String alias, FileChangeEventHandler callback)
   System.Web.HttpApplicationFactory.SetupChangesMonitor()
   System.Web.HttpApplicationFactory.Init()
   System.Web.HttpApplicationFactory.EnsureInited()
   System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context)
   System.Web.HttpRuntime.ProcessRequestInternal (HttpWorkerRequest wr)

I gave both the ASP.NET Machine account and the everyone group full rights to the directory. I can play arround with the paths, but that did nothing more than giving an "Bad request" error. I found a lot of samples on google, but they all don't seem to work (they are the same as my code).

Anyone got a working sample of SimpleWorkerRequest or can point me in the correct direction to solve this issue?

Thanks.

JohnAskew
JohnAskew
9 girl in pink sweater
http://msdn2.microsoft.com/en-us/library/cc0d3x72(VS.80).aspx

online help wrote:

Parameters appVirtualDir 
   The virtual path to the application directory; for example, "/app".
appPhysicalDir 
   The physical path to the application directory; for example, "c:\app".
  page 
   The virtual path for the request (relative to the application directory).
query   
   The text of the query string.
output 
   A TextWriter that captures the output from the response.


I think your 'page' parameter needs no 'test' portion.
stevo_
stevo_
Human after all
I can't imagine this working in a medium trust environment (I could be wrong). You should be careful when breaking the barrier of medium trust, as most asp.net hosting platforms aren't dedicated and generally run as shared with medium trust per app.
page 1 of 1
Comments: 4 | Views: 4859
Microsoft Communities