无法映射路径' /' MySQL的

时间:2014-10-15 13:37:18

标签: mysql asp.net

我尝试使用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:无法映射路径&#39; /&#39;。]
  System.Web.Configuration.ProcessHostConfigUtils.MapPathActual(字符串   siteName,VirtualPath路径)+224
  System.Web.Configuration.ProcessHostMapPath.MapPathCaching(字符串   siteID,VirtualPath路径)+865
  System.Web.Configuration.ProcessHostMapPath.GetPathConfigFilenameWorker(字符串   siteID,VirtualPath路径,字符串&amp;目录,字符串&amp; baseName)+13
  System.Web.Configuration.ProcessHostMapPath.System.Web.Configuration.IConfigMapPath.GetPathConfigFilename(字符串   siteID,String path,String&amp;目录,字符串&amp; baseName)+37
  System.Web.Configuration.HostingPreferredMapPath.GetPathConfigFilename(字符串   siteID,String path,String&amp;目录,字符串&amp; baseName)+75
  System.Web.Configuration.WebConfigurationHost.GetStreamName(字符串   configPath)+9844796
  System.Configuration.Internal.DelegatingConfigHost.GetStreamName(字符串   configPath)+11
  System.Configuration.BaseConfigurationRecord.InitConfigFromFile()+134

     

[ConfigurationErrorsException:加载一个错误   配置文件:无法映射路径&#39; /&#39;。]   System.Configuration.ConfigurationSchemaErrors.ThrowIfErrors(布尔   ignoreLocal)+658656
  System.Configuration.BaseConfigurationRecord.ThrowIfParseErrors(ConfigurationSchemaErrors   schemaErrors)+34 System.Configuration.Configuration..ctor(String   locationSubPath,Type typeConfigHost,Object []   hostInitConfigurationParams)+328
  System.Configuration.Internal.InternalConfigConfigurationFactory.System.Configuration.Internal.IInternalConfigConfigurationFactory.Create(类型   typeConfigHost,Object [] hostInitConfigurationParams)+29
  System.Web.Configuration.WebConfigurationHost.OpenConfiguration(WebLevel   webLevel,ConfigurationFileMap文件映射,VirtualPath路径,String站点,   String locationSubPath,String server,String userName,String   密码,IntPtr tokenHandle)+387
  System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(字符串   路径)+76
  MySql.Web.SessionState.MySqlSessionStateStore.Initialize(String name,   NameValueCollection config)+437
  System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings   providerSettings,Type providerType)+597
  System.Web.SessionState.SessionStateModule.SecureInstantiateProvider(ProviderSettings   设置)+43
  System.Web.SessionState.SessionStateModule.InitCustomStore(SessionStateSection   config)+87
  System.Web.SessionState.SessionStateModule.InitModuleFromConfig(HttpApplication的   app,SessionStateSection config)+9777245
  System.Web.SessionState.SessionStateModule.Init(HttpApplication app)   +159 System.Web.HttpApplication.InitModulesCommon()+80 System.Web.HttpApplication.InitModules()+64
  System.Web.HttpApplication.InitInternal(HttpContext context,   HttpApplicationState状态,MethodInfo []处理程序)+792
  System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext的   上下文)+336
  System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext的   上下文)+107
  System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)   525

1 个答案:

答案 0 :(得分:0)

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

<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”并修正错误。