无法自动创建ASPNETDB.MDF - Visual Web Developer中前preSS 2008 / SQL防爆$ P $ 2008 PSS [英] Unable to Auto-Create ASPNETDB.MDF - Visual Web Developer Express 2008 / SQL Express 2008

查看:189
本文介绍了无法自动创建ASPNETDB.MDF - Visual Web Developer中前preSS 2008 / SQL防爆$ P $ 2008 PSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我开始学习ASP.net / SQL。我安装了SQL Server 2008R2前preSS版;和Visual Web设计2008例preSS版。我最近尝试创建一个登录页面,是不成功的;任何帮助将是AP preciated。我试图通过采取以下步骤:

- 创建新网站
依序前往设计视图
-Drag登录状态为设计图。拖登录控制到设计视图为好;
- 在Web.config中我改变了身份验证的形式,在登录(剪掉添加其他东西)
-ruN的页面没有调试/类型中的任何信息有一个ASPNETDB.MDF文件自动创建了我的App_Data文件文件夹;
我收到以下错误。

请注意:SQL Server有允许远程连接已启用,在配置管理器我启用TCP / IP和管道(这些都是措施,我花了一个事实,即我不能让DB自动创建之后)我曾尝试连接数据库我的Visual Web设计程序。另外值得一提的是,当连接数据库我使用​​。\\或本地主机\\没有istance的名字,因为这是V.W.Designer检测我的数据库的唯一途径。

堆栈跟踪,你不能在图片中看到的是如下:


  

[SQLEXCEPTION(0x80131904):在与SQL Server建立连接时出现与网络相关的或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server配置为允许远程连接。 (提供者:SQL网络接口,错误:26 - 错误定位服务器/实例指定)
     System.Data.SqlClient.SqlInternalConnection.OnError(SqlException异常,布尔breakConnection)4849015
     System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)+194
     System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo,SqlInternalConnectionTds connHandler,布尔ignoreSniOpenTimeout,Int64的timerExpire,布尔值加密,布尔trustServerCert,布尔integratedSecurity,SqlConnection的owningObject)4862333
     System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo,字符串NEWPASSWORD,布尔ignoreSniOpenTimeout,Int64的timerExpire,SqlConnection的owningObject)+90
     System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(主机字符串,字符串NEWPASSWORD,布尔redirectedUserInstance,SqlConnection的owningObject,SqlConnectionString connectionOptions,Int64的timerStart)+376
     System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection的owningObject,SqlConnectionString connectionOptions,字符串NEWPASSWORD,布尔redirectedUserInstance)+221
     System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity身份,SqlConnectionString connectionOptions,对象providerInfo,字符串NEWPASSWORD,SqlConnection的owningObject,布尔redirectedUserInstance)189
     System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions选项,对象poolGroupProviderInfo,池类DBConnectionPool,的DbConnection owningConnection)4863459
     System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(的DbConnection owningConnection,DbConnectionPoolGroup poolGroup)+29
     System.Data.ProviderBase.DbConnectionFactory.GetConnection(的DbConnection owningConnection)4865788
     System.Data.ProviderBase.DbConnectionClosed.OpenConnection(的DbConnection outerConnection,DbConnectionFactory connectionFactory的)+117
     System.Data.SqlClient.SqlConnection.Open()+122
     System.Web.Management.SqlServices.GetSqlConnection(字符串服务器,用户字符串,字符串密码,布尔信赖,字符串的connectionString)+82


  
  

[HttpException(0x80004005的):无法连接到SQL Server数据库]
     System.Web.Management.SqlServices.GetSqlConnection(字符串服务器,用户字符串,字符串密码,布尔信赖,字符串的connectionString)+137
     System.Web.Management.SqlServices.SetupApplicationServices(字符串服务器,用户字符串,字符串密码,布尔信赖,字符串的connectionString,数据库字符串,字符串dbFileName,SqlFeatures功能,布尔安装)+94
     System.Web.Management.SqlServices.Install(数据库字符串,字符串dbFileName,字符串的connectionString)+25
     System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(字符串fullFileName,DATADIR字符串,字符串的connectionString)395



解决方案

我能得到它的工作!事情值得一提/考虑,如果你的调试相同的问题。

当连接到数据库我将不得不使用localhost \\而不是一个实例。
如果你做的一样好,不能正确连接,并有正上方,然后列出的错误安装命名实例(安装SQL Server,当你到了实例菜单,不使用默认使用一个命名实例 - 我用SQLEx preSS )
我也改变的事实,之前我将只使用windows身份验证以登录到我的服务器,当我重新安装我允许混合代替。

这些只是我做的,其实让我的数据库中自动创建的,我需要的方式改变它。

也web.config中更改身份验证部分,而不是,表单窗口。

也确保您的Visual Web Developer在Visual Web Developer中正确的SQL实例(我用2008年)进入 - 工具 - >选项 - >单击显示所有设置在底盒左转 - >数据库工具 - >数据连接 - > SQL Server实例应具有相同的名称,你之前安装实例

这应该处理尝试使用一个登录页面的第一次,当你得到的错误26。
其他有用的链接被张贴在此页:<一href=\"http://stackoverflow.com/questions/13050262/creating-mdf-with-sql-2008-ex$p$pss-visual-web-developer-2008\">Creating .MDF随着SQL 2008 EX preSS /的Visual Web Developer 2008

I Recently began learning ASP.net / SQL. I Installed Sql Server 2008R2 Express Edition; and Visual Web Designer 2008 Express Edition. I recently tried to create a login page and was unsuccessful; any help would be appreciated. I tried by taking the following steps:
-Create New WebSite
-Go to design view
-Drag "login status" into design view; Drag "Login" control onto design view as well;
-In Web.config I changed the authentication to "forms" (didnt add anything else)
-Run the page without debug / Type in any information in the login to have a "ASPNETDB.MDF" file automatically created into my "app_data" folder; and i receive the error below.

Note: Sql Server has "allow Remote connections" enabled, In configuration manager i enabled tcp/ip and "pipes" (these were measures i took after the fact that i couldnt get the DB auto created.) I Have tried "connecting databases" to my visual web designer program. Also worth noting that When connecting databases i use .\ or localhost\ no istance name because this is the only way V.W.Designer detects my databases.

The stack trace you cant see in the picture is as follow:

[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4849015 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194 System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject) +4862333 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) +90 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart) +376 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +221 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +189 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +4863459 System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +29 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +4865788 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117 System.Data.SqlClient.SqlConnection.Open() +122 System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +82

[HttpException (0x80004005): Unable to connect to SQL Server database.] System.Web.Management.SqlServices.GetSqlConnection(String server, String user, String password, Boolean trusted, String connectionString) +137 System.Web.Management.SqlServices.SetupApplicationServices(String server, String user, String password, Boolean trusted, String connectionString, String database, String dbFileName, SqlFeatures features, Boolean install) +94 System.Web.Management.SqlServices.Install(String database, String dbFileName, String connectionString) +25 System.Web.DataAccess.SqlConnectionHelper.CreateMdfFile(String fullFileName, String dataDir, String connectionString) +395

解决方案

I Was able to get it working! Things worth mentioning / thinking about if your debugging the same issue.

When connecting to databases i would have to use Localhost\ As opposed to an instance. If you do as well and cannot connect properly and have the error listed above then install a named instance (install sql server and when you get to the Instance menu, dont use "default" use a named instance - i used SQLExpress) I also changed the fact that before i would use only "windows authentication" for logging on to my server and when i re-installed i allowed "Mixed" instead.

Those were the only changes i made that actually allowed my Database to be automatically created the way i needed it to.

also in web.config change the authentication section to "Forms" instead of "Window.

also be sure that your visual web developer has the correct SQL instance in visual web developer (i used 2008) go to - Tools -> options -> Click the show all settings box at the bottom left -> database tools -> Data connections -> SQL Server instance should have the Same name as the instance you installed prior.

These should handle the error 26 you get when trying to use a login page for the first time. Other helpful links were posted in this page: Creating .MDF With SQL 2008 EXPRESS/ Visual Web Developer 2008

这篇关于无法自动创建ASPNETDB.MDF - Visual Web Developer中前preSS 2008 / SQL防爆$ P $ 2008 PSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆