2013-05-10 68 views
0

我在Centos 6.4上安装了来自源代码的mono,以测试msc asp网站。 它似乎罚款的所有工作,但 某些页面在Debian返回该错误asp.net on mono无法映射路径'/'

System.InvalidOperationException 
Failed to map path '/' 

Description: HTTP 500.Error processing request. 
Details: Non-web exception. Exception origin (name of application or object): 
System.Web. 
    at System.Web.HttpRequest.MapPath (System.String virtualPath, System.String baseVirtualDir, Boolean allowCrossAppMapping) [0x00000] in <filename unknown>:0 
    at System.Web.HttpRequest.MapPath (System.String virtualPath) [0x00000] in <filename unknown>:0 
    at System.Web.Hosting.HostingEnvironment.MapPath (System.String virtualPath) [0x00000] in <filename unknown>:0 
    at System.Web.Hosting.DefaultVirtualPathProvider.DirectoryExists (System.String virtualDir) [0x00000] in <filename unknown>:0 
    at System.Web.Configuration.WebConfigurationManager.FindWebConfig (System.String path, System.Boolean& inAnotherApp) [0x00000] in <filename unknown>:0 
    at System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration (System.String path, System.String site, System.String locationSubPath, System.String server, System.String userName, System.String password, Boolean fweb) [0x00000] in <filename unknown>:0 
    at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName, System.String path, System.Web.HttpContext context) [0x00000] in <filename unknown>:0 
    at System.Web.Configuration.WebConfigurationManager.GetSection (System.String sectionName, System.String path) [0x00000] in <filename unknown>:0 
    at System.Web.Security.SqliteMembershipProvider.Initialize (System.String name, System.Collections.Specialized.NameValueCollection config) [0x00000] in <filename unknown>:0 
    at System.Web.Configuration.ProvidersHelper.InstantiateProvider (System.Configuration.ProviderSettings providerSettings, System.Type providerType) [0x00000] in <filename unknown>:0 
    at System.Web.Configuration.ProvidersHelper.InstantiateProviders (System.Configuration.ProviderSettingsCollection configProviders, System.Configuration.Provider.ProviderCollection providers, System.Type providerType) [0x00000] in <filename unknown>:0 
    at System.Web.Security.Membership..cctor() [0x00000] in <filename unknown>:0 

我也做了同样的事情,它工作正常。

你有什么建议吗?

回答

0

找到所有你Server.MapPaths与变革

Server.MapPaths(@ “\”)

Server.MapPaths(Path.DirectorySeparatorChar)

+0

在web.config中? 我没有找到那个标签... – user2369620 2013-05-10 12:00:44

-1

我有相同的错误,完全相同的堆栈跟踪。 刚刚启动apache时,它仅发生在第一个请求上。第一次请求后,错误没有发生。

我通过移除WebMatrix.WebData.dll

这当您使用SimpleMembershipProvider,它可能会在MVC4影响OpenAuth功能将可能有一些后果解决了这个。

+0

它确实提供了我的问题的答案,它可能会为其他人回答问题。 但上面的评论没有。 如果我的回答不明白,随时问! – Tidbit 2014-11-10 18:13:24

0

你检查过你的视图文件中的路径吗?正如一个提醒:

“/”像<script src="/myScript.js"></script>映射到你的/sites-available/.conf定义DocumentRoot文件夹中,也可能是类似的/ var/WWW

“〜/”像<script src="@Url.Content("~/scripts/script1.js")"></script>映射到您的mvc应用程序的路径,它可能是事端/ var/www/site1

'../'会尝试访问DocumentRoot文件夹上的一个文件夹。这实际上可能被你的apache站点配置禁止(推荐)。

另请注意,如果您从monodevelop/xspServer运行您的mvc应用程序,文档根目录和mvc应用程序路径实际上是相同的,但是如果您在apache上安装mvc应用程序,它们可能不是相同的路径。发生

0

此错误的原因是单声道的System.Web中的错误

它包含此检查(https://github.com/mono/mono/blob/mono-3.2.1-branch/mcs/class/System.Web/System.Web/HttpRequest.cs#L1565

if (!isAppVirtualPath && !virtualPath.StartsWith (appVirtualPath, RuntimeHelpers.StringComparison)) 
     throw new InvalidOperationException (String.Format ("Failed to map path '{0}'", virtualPath)); 

为了解决这个问题,你可以发表评论在单surce代码和再这些线路 - 编译单声道。 这个bug也是在最新的Mono中。

链接:

https://bugzilla.xamarin.com/show_bug.cgi?id=24457