1

嗨,我正在使用 Visual Studio Ultimate 2012 VB.NET

我正在尝试使用 Visual Studio Web 表单设置我网站的新部分。我希望用户能够使用 Twitter id 登录。所以我创建了我的 Twitter 登录应用程序并将我的 2 个密钥“Consumer key”和“Consumer secret”密钥插入到我的“AuthConfig.vb”文件中

然后我使用 Visual Studios 设置我的数据库“连接到数据库”它成功连接到我的数据库。我知道这一点,因为在弹出一条消息告诉我“连接成功”之后。然后我就可以使用 Visual Studio 在我的数据库上设置一个表。我确认该表是通过登录到我的 GoDaddy 服务器并检查正在显示的数据库表来创建的,并且确实如此。(所以这证实了 VS 可以连接到数据库。

所以这就是发生的事情,我转到我刚刚在 VS 中创建的新页面,这是一个 http://mastersworldofcomputing.com/basic-learning/Default.aspx

然后我点击“登录”,这会将我带到下面的这个页面。 http://mastersworldofcomputing.com/basic-learning/Account/Login.aspx

然后我点击我们刚刚创建的“Twitter 按钮”(这应该让我使用 Twitter id 登录)然后我被带到 Twitter 登录页面,所以我输入用户名和密码并点击“登录”。然后我得到一个闪屏,告诉我它正在将我重定向到我的页面,但几秒钟后它把我带到一个错误页面。下面显示信息。

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Invalid value for key 'attachdbfilename'.

Source Error:


Line 90:         ' User has logged in with provider successfully
Line 91:         ' Check if user is already registered locally
Line 92:         If OpenAuth.Login(authResult.Provider, authResult.ProviderUserId, createPersistentCookie:=False) Then
Line 93:             RedirectToReturnUrl()
Line 94:         End If


Source File: D:\hosting\7560507\html\basic-learning\Account\RegisterExternalLogin.aspx.vb    Line: 92

堆栈跟踪:

[ArgumentException: Invalid value for key 'attachdbfilename'.]
System.Data.SqlClient.SqlConnectionString.VerifyLocalHostAndFixup(String& host, Boolean enforceLocalHost, Boolean fixup) +907262
System.Data.SqlClient.SqlConnectionString..ctor(String connectionString) +4116
System.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) +24
System.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(String connectionString, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) +150
System.Data.SqlClient.SqlConnection.ConnectionString_Set(String value) +59
System.Data.SqlClient.SqlConnection.set_ConnectionString(String value) +4
           System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings appConfigConnection) +122
System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name, AppConfig config) +32
System.Data.Entity.Internal.LazyInternalConnection.Initialize() +131
System.Data.Entity.Internal.LazyInternalConnection.get_ProviderName() +13
System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +332
System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +18
System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +56
System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +15
System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +37
System.Linq.Queryable.Where(IQueryable`1 source, Expression`1 predicate) +63  
Microsoft.AspNet.Membership.OpenAuth.EFOpenAuthMembershipDatabase.GetMembershipUserName(String providerName, String providerUserId, Boolean updateLastUsed) +891
Microsoft.AspNet.Membership.OpenAuth.OpenAuthManager.Login(HttpContextBase context, String providerName, String providerUserId, Boolean createPersistentCookie) +105
Microsoft.AspNet.Membership.OpenAuth.OpenAuth.Login(String providerName, String providerUserId, Boolean createPersistentCookie) +95
Account_RegisterExternalLogin.ProcessProviderResult() in D:\hosting\7560507\html\basic-learning\Account\RegisterExternalLogin.aspx.vb:92
Account_RegisterExternalLogin.Page_Load(Object sender, EventArgs e) in D:\hosting\7560507\html\basic-learning\Account\RegisterExternalLogin.aspx.vb:48
System.Web.UI.Control.OnLoad(EventArgs e) +91
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2207

我的 web.config 文件看起来像

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
 <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-WebSite17-20121215190635;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-WebSite17-20121215190635.mdf" />
</connectionStrings>
<system.web>
<compilation debug="true" strict="true" explicit="true" targetFramework="4.0" />
<authentication mode="Forms">
  <forms loginUrl="~/Account/Login.aspx" timeout="2880" />
  </authentication>
  <profile defaultProvider="DefaultProfileProvider">
  <providers>
    <add name="DefaultProfileProvider" type="System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
  </providers>
  </profile>
  <membership defaultProvider="DefaultMembershipProvider">
  <providers>
    <add name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
  </providers>
  </membership>
  <roleManager defaultProvider="DefaultRoleProvider">
  <providers>
    <add name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" applicationName="/" />
  </providers>
 </roleManager>
  <sessionState mode="InProc" customProvider="DefaultSessionProvider">
  <providers>
    <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
  </providers>
</sessionState>
</system.web>
<system.webServer>
 <modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<entityFramework>.

<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
  <parameters>
    <parameter value="v11.0" />
  </parameters>
 </defaultConnectionFactory>
 </entityFramework>
 </configuration>

有没有人可以让我在这里走上正确的轨道,这样我就可以克服这个问题。我必须阅读一百个线程,却无处可寻。如果还有其他可能有用的信息,请告诉我感谢您的阅读。

4

0 回答 0