Failed to map the path '/url-rewrite-log.txt'.

Jul 5, 2009 at 2:01 PM

I get the error Failed to map the path '/url-rewrite-log.txt' whenever I try to run the examples or create my own. What am I doing wrong?

Failed to map the path '/url-rewrite-log.txt'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Failed to map the path '/url-rewrite-log.txt'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[InvalidOperationException: Failed to map the path '/url-rewrite-log.txt'.]
   System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull) +8853082
   System.Web.Hosting.HostingEnvironment.MapPathInternal(VirtualPath virtualPath) +42
   System.Web.Hosting.HostingEnvironment.MapPath(VirtualPath virtualPath) +51
   System.Web.Hosting.HostingEnvironment.MapPath(String virtualPath) +19
   ManagedFusion.Rewriter.Engines.ApacheRuleSet.RefreshRules(TextReader reader) in C:\Users\Nick\Documents\Projects\Managed Fusion\ManagedFusion.Rewriter\Source\Engines\ApacheRuleSet.cs:394
   ManagedFusion.Rewriter.Engines.ApacheRuleSet.RefreshRules() in C:\Users\Nick\Documents\Projects\Managed Fusion\ManagedFusion.Rewriter\Source\Engines\ApacheRuleSet.cs:378
   ManagedFusion.Rewriter.Engines.ApacheEngine.RefreshRules() in C:\Users\Nick\Documents\Projects\Managed Fusion\ManagedFusion.Rewriter\Source\Engines\ApacheEngine.cs:271
   ManagedFusion.Rewriter.Engines.ApacheEngine.Init() in C:\Users\Nick\Documents\Projects\Managed Fusion\ManagedFusion.Rewriter\Source\Engines\ApacheEngine.cs:262
   ManagedFusion.Rewriter.Manager..cctor() in C:\Users\Nick\Documents\Projects\Managed Fusion\ManagedFusion.Rewriter\Source\Manager.cs:290

[TypeInitializationException: The type initializer for 'ManagedFusion.Rewriter.Manager' threw an exception.]
   ManagedFusion.Rewriter.Manager.get_ApplicationRulesNeedLoading() in C:\Users\Nick\Documents\Projects\Managed Fusion\ManagedFusion.Rewriter\Source\Manager.cs:83
   ManagedFusion.Rewriter.RewriterModule.context_BeginRequest(Object sender, EventArgs e) in C:\Users\Nick\Documents\Projects\Managed Fusion\ManagedFusion.Rewriter\Source\RewriterModule.cs:111
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

<font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

Version Information: Microsoft .NET Framework Version:2.0.50727.3074; ASP.NET Version:2.0.50727.3074

</font>

 

Coordinator
Jul 6, 2009 at 12:31 AM
Edited Jul 6, 2009 at 12:32 AM

Please post the RewriteLog path that you are using in the rules config. 

Jul 7, 2009 at 1:44 AM

I wasn't using one. I didn't see a RewriteLog in the example, so I didn't know it was needed. Seems to be working fine now, thanks!

One other question. Does this work with ASP.NET Ajax Update Panels? I seem to be having trouble with getting that to work. I keep getting a 404 on postbacks.

Thank you for your time.

Coordinator
Jul 7, 2009 at 2:44 AM
Edited Jul 7, 2009 at 2:45 AM

No you shouldn't need one.  That command should only be activated if it finds a RewriteLog command in your config file.  

Also it should work just fine with the AJAX Update Panel, but the trick is figuring out the URL of the Update Panel so that you can pass it through unharmed.

Jul 7, 2009 at 9:49 AM

Thanks Nick.

I figured out the AJAX Update Panel in a way that doesn't require adding Rewrite Rules for each panel, and works across the entire site. I'm posting it here in case anyone else comes across the same problem and/or if you want to incorporate it into the documentation.

Just follow the instructions for adding a FormRewriterControlAdapter as exampled under "So what's the problem?" located here http://msforge.net/blogs/janko/archive/2007/12/17/url-rewriting-in-asp-net-2-0.aspx

The solution works perfectly with the ManagedFusion Rewriter and I'm completely happy with the result.

Thanks so much.

Feb 19, 2010 at 9:50 PM

What is the resolution to this problem??  I had the sample project running just fine, then transplanted the code into an existing .NET project.

My stack trace is identical to the one in this post.  My config file contents are as follows:

RewriteEngine On
RewriteLog c:\log.txt    (I've also tried   \url-rewriter-log.txt,  log.txt,  "log.txt" and nothing makes any difference)
RewriteLogLevel 9

RewriteRule ^/App1/(.*)    http://localhost:6750/$1 [P]
RewriteRule ^/App2/(.*)    http://localhost:6751/$1 [P]

Here's my stack trace:

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[InvalidOperationException: Failed to map the path '/url-rewrite-log.txt'.]
System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull) +8856394
System.Web.Hosting.HostingEnvironment.MapPathInternal(VirtualPath virtualPath) +42
System.Web.Hosting.HostingEnvironment.MapPath(VirtualPath virtualPath) +51
System.Web.Hosting.HostingEnvironment.MapPath(String virtualPath) +19
ManagedFusion.Rewriter.RuleSet..cctor() in C:\Users\Nick\Documents\Projects\Managed Fusion\ManagedFusion.Rewriter\Source\RuleSet.cs:49

[TypeInitializationException: The type initializer for 'ManagedFusion.Rewriter.RuleSet' threw an exception.]
ManagedFusion.Rewriter.Engines.ApacheEngine.ScanDirectoriesForRules(DirectoryInfo refreshDir) in C:\Users\Nick\Documents\Projects\Managed Fusion\ManagedFusion.Rewriter\Source\Engines\ApacheEngine.cs:129
ManagedFusion.Rewriter.Engines.ApacheEngine.Init() in C:\Users\Nick\Documents\Projects\Managed Fusion\ManagedFusion.Rewriter\Source\Engines\ApacheEngine.cs:258
ManagedFusion.Rewriter.Manager..cctor() in C:\Users\Nick\Documents\Projects\Managed Fusion\ManagedFusion.Rewriter\Source\Manager.cs:290

[TypeInitializationException: The type initializer for 'ManagedFusion.Rewriter.Manager' threw an exception.]
ManagedFusion.Rewriter.Manager.get_ApplicationRulesNeedLoading() in C:\Users\Nick\Documents\Projects\Managed Fusion\ManagedFusion.Rewriter\Source\Manager.cs:83
ManagedFusion.Rewriter.RewriterModule.context_BeginRequest(Object sender, EventArgs e) in C:\Users\Nick\Documents\Projects\Managed Fusion\ManagedFusion.Rewriter\Source\RewriterModule.cs:111
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Feb 19, 2010 at 9:51 PM

Please note that I'm running this on a Cassini server.

Here's the .net version info:



Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET Version:2.0.50727.4016

 

Coordinator
Feb 20, 2010 at 2:39 AM

What version of the rewriter are you using?

Feb 22, 2010 at 3:35 PM

I was using 3.0.0.   Downloaded 3.5.2 and all was resolved.   I should have checked that first.  Sorry guys.

Great product!

 

Coordinator
Feb 23, 2010 at 1:13 AM

No problem thanks for using our product.