Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 无法在连接字符串错误的应用上添加身份验证_Vb.net_Asp.net Mvc 3_Authentication - Fatal编程技术网

Vb.net 无法在连接字符串错误的应用上添加身份验证

Vb.net 无法在连接字符串错误的应用上添加身份验证,vb.net,asp.net-mvc-3,authentication,Vb.net,Asp.net Mvc 3,Authentication,我正在尝试使用内置提供程序向我的应用程序添加身份验证,但这样做时出错。我的web.config文件如下所示(将db etc从连接字符串中取出,但可以完成所有工作): 我希望身份验证和应用程序设置存储在现有数据库中。如何修复此问题?提供程序项的connectionStringName属性设置为“ApplicationServices”,它不是web.config中的命名连接字符串。您的连接字符串名为“LaundryDBContext” 将connnectionStringName属性更改为“Lau

我正在尝试使用内置提供程序向我的应用程序添加身份验证,但这样做时出错。我的web.config文件如下所示(将db etc从连接字符串中取出,但可以完成所有工作):


我希望身份验证和应用程序设置存储在现有数据库中。如何修复此问题?

提供程序项的connectionStringName属性设置为“ApplicationServices”,它不是web.config中的命名连接字符串。您的连接字符串名为“LaundryDBContext”

将connnectionStringName属性更改为“LaundryDBContext”,提供者将使用该连接字符串与数据库对话

你应该更详细地了解它是如何工作的

简言之

  • 打开visual studio命令提示符并键入
    aspnet\u regsql
  • 按照打开的对话框中的向导将aspnet成员身份架构添加到数据库中

  • 我现在已经这样做了,但是我得到了以下错误:找不到存储过程“dbo.aspnet\u CheckSchemaVersion”。这是因为您没有对数据库运行aspnet\u regsql.exe。此工具将创建存储成员数据所需的表。我还更改了初始目录以重新创建数据库,并出现以下错误:无法打开登录请求的“新建”数据库。登录失败。用户“dbuser”登录失败。尽管我知道该用户的连接详细信息是正确的。您有关于如何操作的教程吗?非常感谢!像做梦一样工作!
    <?xml version="1.0"?>
    <!--
      For more information on how to configure your ASP.NET application, please visit
      http://go.microsoft.com/fwlink/?LinkId=152368
      -->
    
    <configuration>
    
      <connectionStrings>
        <add name="LaundryDBContext"
             connectionString=".amazonaws.com,1433;
             Initial Catalog=Main;
             Persist Security Info=True;
             User ID=****;
             Password=****;
             MultipleActiveResultSets=True"
             providerName="System.Data.SqlClient"/>
      </connectionStrings>
    
      <appSettings>
        <add key="webpages:Version" value="1.0.0.0"/>
        <add key="ClientValidationEnabled" value="true"/>
        <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
      </appSettings>
    
      <system.web>
        <compilation debug="true" targetFramework="4.0">
          <assemblies>
            <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
            <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
          </assemblies>
        </compilation>
    
        <authentication mode="Forms">
          <forms loginUrl="~/Account/LogOn" timeout="2880" />
        </authentication>
    
        <membership>
          <providers>
            <clear/>
            <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices"
                 enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
                 maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
                 applicationName="/" />
          </providers>
        </membership>
    
        <profile>
          <providers>
            <clear/>
            <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
          </providers>
        </profile>
    
        <roleManager enabled="false">
          <providers>
            <clear/>
            <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
            <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
          </providers>
        </roleManager>
    
        <pages>
          <namespaces>
            <add namespace="System.Web.Helpers" />
            <add namespace="System.Web.Mvc" />
            <add namespace="System.Web.Mvc.Ajax" />
            <add namespace="System.Web.Mvc.Html" />
            <add namespace="System.Web.Routing" />
            <add namespace="System.Web.WebPages"/>
          </namespaces>
        </pages>
      </system.web>
    
      <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <modules runAllManagedModulesForAllRequests="true"/>
      </system.webServer>
    
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    </configuration>
    
    The connection name 'ApplicationServices' was not found in the applications configuration or the connection string is empty.