0

Centos 6.4 にソースから mono をインストールして、msc asp Web サイトをテストしました。一部のページがこのエラーを返すことを除いて、すべて正常に動作しているようです

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 

私はdebianで同じことをしましたが、うまくいきます。

何か提案はありますか?

4

4 に答える 4

0

このエラーは、mono 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));

これを修正するには、Mono surce コードでこれらの行にコメントを付けて、Mono を再コンパイルします。このバグは最新の Mono にもあります。

リンク:

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

于 2015-02-01T22:11:41.717 に答える
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 フォルダーの上の 1 つのフォルダーにアクセスしようとします。これは実際には、Apache サイトの構成によって禁止されている場合があります (推奨)。

また、monodevelop/xspServer から mvc アプリを実行する場合、ドキュメント ルートと mvc アプリケーション パスは実際には同じですが、mvc アプリを apache にインストールする場合、それらは同じパスではない可能性があることに注意してください。

于 2014-11-11T16:05:38.340 に答える
0

すべての Server.MapPaths を見つけて、から変更します

Server.MapPaths(@"\")

Server.MapPaths(Path.DirectorySeparatorChar)

于 2013-05-10T11:03:55.883 に答える