ServicesResourcesConferencesOur TeamWeblogsAboutContact
   
ASP.NET and RemotingConfiguration.Configure()

Robert just pointed out a bug in one of my Remoting FAQ articles. If you use ASP.NET as a Remoting client, you should not use this code in your app.config:

protected void Application_Start(Object sender, EventArgs e)
{
   RemotingConfiguration.Configure(Server.MapPath("client.exe.config"));
}

Using Server.MapPath(), some requests might fail if the application is recycled and the first request is not for a file in the application's root directory but in a subdirectory (i.e. "http://yourhost/somedir/default.aspx" instead of "http://yourhost/default.aspx". Robert suggested to use the following (and of course, he's totally right):

protected void Application_Start(Object sender, EventArgs e)
{
   RemotingConfiguration.Configure(Request.PhysicalApplicationPath + "client.exe.config");
}

Thanks, Robert!

posted on Saturday, May 22, 2004 8:58 PM

# re: ASP.NET and RemotingConfiguration.Configure() @ Wednesday, December 21, 2005 10:02 AM

I can't use Request.PhysicalApplicationPath
But I can use HttpContext.Current.Request.PhysicalApplicationPath;
Bear


Powered by Community Server, by Telligent Systems