【问题标题】:Failed to map the path '/' MySQL无法映射路径 '/' MySQL
【发布时间】:2014-12-10 14:49:00
【问题描述】:

我正在尝试使用 web.config 连接到 MySQL,并为此使用了 MySQL 网站配置。问题是它使我的网站在运行而不是运行时显示错误。 :D

这是我的 web.config SQL 连接:

<connectionStrings>
    <remove name="LocalMySqlServer" />
    <add name="LocalMySqlServer" connectionString="password=PASS****;user id=9b443f_users;server=MYSQL5008.myWindowsHosting.com;database=db_9b443f_users" providerName="MySql.Data.MySqlClient" />
  </connectionStrings>
  <system.web>
    <sessionState mode="Custom" cookieless="true" regenerateExpiredSessionId="true" customProvider="MySqlSessionStateProvider">
      <providers>
        <add name="MySqlSessionStateProvider" type="MySql.Web.SessionState.MySqlSessionStateStore, MySql.Web, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" applicationName="Sessions" description="Sessions" connectionStringName="LocalMySqlServer" writeExceptionsToEventLog="True" autogenerateschema="True" enableExpireCallback="False" />
      </providers>
    </sessionState>
    <profile defaultProvider="MySQLProfileProvider">
      <providers>
        <remove name="MySQLProfileProvider" />
        <add name="MySQLProfileProvider" type="MySql.Web.Profile.MySQLProfileProvider, MySql.Web, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" applicationName="Profiles" description="Profiles" connectionStringName="LocalMySqlServer" writeExceptionsToEventLog="True" autogenerateschema="True" enableExpireCallback="False" />
      </providers>
    </profile>
    <membership defaultProvider="MySQLMembershipProvider">
      <providers>
        <remove name="MySQLMembershipProvider" />
        <add name="MySQLMembershipProvider" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" applicationName="MemRecords" description="MySQL default application" connectionStringName="LocalMySqlServer" writeExceptionsToEventLog="True" autogenerateschema="True" enableExpireCallback="False" enablePasswordRetrieval="False" enablePasswordReset="True" requiresQuestionAndAnswer="True" requiresUniqueEmail="True" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" />
      </providers>
    </membership>
    <roleManager enabled="true" defaultProvider="MySQLRoleProvider">
      <providers>
        <remove name="MySQLRoleProvider" />
        <add name="MySQLRoleProvider" type="MySql.Web.Security.MySQLRoleProvider, MySql.Web, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" applicationName="Roles" description="Roles" connectionStringName="LocalMySqlServer" writeExceptionsToEventLog="False" autogenerateschema="True" enableExpireCallback="False" />
      </providers>
    </roleManager>
    <compilation debug="true" targetFramework="4.0" />
    <identity impersonate="false" />
    <authentication mode="Forms">
      <forms loginUrl="default.aspx" />
    </authentication>
  </system.web>

这是它显示给我的堆栈跟踪:

[InvalidOperationException:无法映射路径“/”。]
System.Web.Configuration.ProcessHostConfigUtils.MapPathActual(字符串 站点名称,VirtualPath 路径)+224
System.Web.Configuration.ProcessHostMapPath.MapPathCaching(字符串 siteID,VirtualPath 路径)+865
System.Web.Configuration.ProcessHostMapPath.GetPathConfigFilenameWorker(字符串 siteID、VirtualPath 路径、String& 目录、String& baseName) +13
System.Web.Configuration.ProcessHostMapPath.System.Web.Configuration.IConfigMapPath.GetPathConfigFilename(字符串 siteID, String path, String& directory, String& baseName) +37
System.Web.Configuration.HostingPreferredMapPath.GetPathConfigFilename(字符串 siteID, String path, String& directory, String& baseName) +75
System.Web.Configuration.WebConfigurationHost.GetStreamName(字符串 配置路径)+9844796
System.Configuration.Internal.DelegatingConfigHost.GetStreamName(字符串 配置路径)+11
System.Configuration.BaseConfigurationRecord.InitConfigFromFile() +134

[ConfigurationErrorsException: 加载一个错误发生 配置文件:映射路径“/”失败。]
System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(布尔值 忽略本地)+658656
System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors schemaErrors)+34 System.Configuration.Configuration..ctor(字符串 locationSubPath,类型 typeConfigHost,Object[] hostInitConfigurationParams) +328
System.Configuration.Internal.InternalConfigurationFactory.System.Configuration.Internal.IInternalConfigurationFactory.Create(类型 typeConfigHost, Object[] hostInitConfigurationParams) +29
System.Web.Configuration.WebConfigurationHost.OpenConfiguration(WebLevel webLevel、ConfigurationFileMap 文件映射、VirtualPath 路径、字符串站点、 字符串 locationSubPath、字符串服务器、字符串用户名、字符串 密码,IntPtr tokenHandle) +387
System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(字符串 路径)+76
MySql.Web.SessionState.MySqlSessionStateStore.Initialize(字符串名称, NameValueCollection 配置)+437
System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings,类型 providerType) +597
System.Web.SessionState.SessionStateModule.SecureInstantiateProvider(ProviderSettings 设置)+43
System.Web.SessionState.SessionStateModule.InitCustomStore(SessionStateSection 配置)+87
System.Web.SessionState.SessionStateModule.InitModuleFromConfig(HttpApplication 应用程序,SessionStateSection 配置)+9777245
System.Web.SessionState.SessionStateModule.Init(HttpApplication 应用程序) +159 System.Web.HttpApplication.InitModulesCommon() +80 System.Web.HttpApplication.InitModules() +64
System.Web.HttpApplication.InitInternal(HttpContext 上下文, HttpApplicationState 状态,MethodInfo[] 处理程序)+792
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext 上下文)+336
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext 上下文)+107
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest WR) +525

【问题讨论】:

    标签: mysql asp.net


    【解决方案1】:

    我刚刚发现,如果我将这些行注释掉,错误就不会出现,网站也会正常工作:

    <sessionState mode="Custom" cookieless="true" regenerateExpiredSessionId="true" customProvider="MySqlSessionStateProvider">
          <providers>
            <add name="MySqlSessionStateProvider" type="MySql.Web.SessionState.MySqlSessionStateStore, MySql.Web, Version=6.8.3.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" applicationName="Sessions" description="Sessions" connectionStringName="LocalMySqlServer" writeExceptionsToEventLog="True" autogenerateschema="True" enableExpireCallback="False" />
          </providers>
        </sessionState>
    

    如何解决它,这样我就不必注释掉了?

    编辑:

    使用“MySQL Website Configuration”并修复了错误。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多