13,347
社区成员
发帖
与我相关
我的任务
分享
Profile.FirstName = "anan";
Profile.LastName = "ouyang";
编译没有问题,
在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: SQL 网络接口, error: 26 - 定位指定的服务器/实例时出错)
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
SQLExpress 数据库文件自动创建错误:
连接字符串使用应用程序 App_Data 目录中的数据库位置指定了一个本地 SQL Server Express 实例。由于提供程序确定应用程序服务数据库不存在,因此试图自动创建该数据库。要成功检查应用程序服务数据库是否存在并自动创建应用程序服务数据库,必须满足下列配置要求:
如果应用程序 App_Data 目录不存在,则 Web 服务器帐户必须具有对应用程序目录的读写访问权限。这是因为如果不存在 App_Data 目录,Web 服务器帐户将会自动创建它。
如果应用程序 App_Data 目录已存在,则 Web 服务器帐户只要求对应用程序 App_Data 目录的读写访问权限。这是必要的,因为 Web 服务器帐户将尝试确认 SQL Server Express 数据库已在应用程序 App_Data 目录中。如果从 Web 服务器帐户撤消对 App_Data 目录的读访问权限,提供程序便无法正确地确定 SQL Server Express 数据库是否已存在。如果提供程序试图创建已存在的数据库的副本,就会出错。写访问权限是必需的,因为创建新数据库时需要使用 Web 服务器帐户凭据。
计算机上必须安装 SQL Server Express。
Web 服务器帐户的进程标识必须具有本地用户配置文件。有关如何为计算机帐户和域帐户创建本地用户配置文件的详细信息,请参见自述文档。
源错误:
执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。
堆栈跟踪:
[SqlException (0x80131904): 在建立与服务器的连接时出错。在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败。 (provider: SQL 网络接口, error: 26 - 定位指定的服务器/实例时出错)]
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846887
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) +4860189
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) +4861315
System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +29
System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +4863644
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): 无法连接到 SQL Server 数据库。]
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
<connectionStrings>
<add name="连接字符串名" connectionString="Data Source=122.*.*.*;Initial Catalog=数据库名;Persist Security Info=True;User ID=***;Password=***" providerName="System.Data.SqlClient"/>
</connectionStrings>
<profile enabled="true" defaultProvider="AspNetSqlProfileProvider" inherits="" automaticSaveEnabled="true">
<providers>
<clear/>
<add connectionStringName="连接字符串"
applicationName="Soccer"
name="AspNetSqlProfileProvider"
type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
</providers>
<properties>
<clear/>
<!--你的自定义属性-->
</properties>
</profile>