“该系统找不到指定的文件”

问题描述 投票:21回答:9

我在这个错误上看到了很多问题。但没有一个与形式有关。我刚刚在本地测试后托管了我的应用服务器。我认为它工作了几分钟,但我不确定,因为我可能已经看了一下localhost选项卡。然后它停止了工作。当我在服务器上进行更改时,我可能已经改变了一些东西。

我检查了我的连接字符串,并尝试使用其他方式登录到数据库,并且它在线。所以,任何可能出错的线索。我不认为sql server可能只是没有响应来自应用程序的请求,并且如果您通过SSMS登录,则可用。

以下是我得到的错误。

'/'应用程序中的服务器错误。

该系统找不到指定的文件

描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.ComponentModel.Win32Exception:系统找不到指定的文件

来源错误:

在执行当前Web请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常的起源和位置的信息。

堆栈跟踪:

[Win32Exception(0x80004005):系统找不到指定的文件]

[SqlException(0x80131904):建立与SQL Server的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。验证实例名称是否正确,以及SQL Server是否配置为允许远程连接。 (提供程序:SQL网络接口,错误:52 - 无法找到本地数据库运行时安装。验证是否已正确安装SQL Server Express并且已启用本地数据库运行时功能。)] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException异常,Boolean breakConnection,Action1 wrapCloseInAction) +5296071 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +558
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover) +5308555
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +145
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +920
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +307
System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions) +434
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +225
System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +37
System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions userOptions) +558
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionOptions userOptions) +67
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1052
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource
1重试,DbConnectionOptions userOptions,DbConnectionInternal&connection)+78 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection,TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +167
System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource
1 retry,DbConnectionOptions userOptions)+143 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry) +83 System.Data.SqlClient.SqlConnection.Open() +96
System.Data.SqlClient.SqlProviderServices.UsingConnection(SqlConnection sqlConnection, Action
1 act)+79 System.Data.SqlClient.SqlProviderServices.UsingMasterConnection(SqlConnection sqlConnection,Action`1 act)+384 System.Data.SqlClient.SqlProviderServices.GetDbProviderManifestToken(DbConnection连接)+241 System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection连接)+26

[ProviderIncompatibleException:提供程序未返回ProviderManifestToken字符串。] System.Data.Common.DbProviderServices.GetProviderManifestToken(DbConnection连接)+170 System.Web.Providers.ModelHelper.GetStorageMetadata(String providerName,DbConnection connection,String ssdl)+35 System.Web.Providers.ModelHelper.CreateMetadataWorkspace(String providerName,DbConnection connection,String csdl,String ssdl,String msl)+154 System.Web.Providers.ModelHelper.CreateEntityConnection(ConnectionStringSettings设置,String csdl,String ssdl,String msl)+109 System.Web.Providers.ModelHelper.CreateMembershipEntities(ConnectionStringSettings setting)+28 System.Web.Providers.DefaultMembershipProvider.GetPasswordWithFormat(String userName,Boolean updateLastLoginActivityDate,Int32&status,String&password,Int32&format,String&salt,Int32&failedPasswordAttemptCount,Int32&failedPasswordAnswerAttemptCount,Boolean&isApproved,DateTime&lastLoginDate,DateTime&lastActivityDate)+118 System.Web.Providers.DefaultMembershipProvider.CheckPassword(String userName,String password,Boolean updateLastActivityDate,Boolean failIfNotApproved,String&salt,Int32&passwordFormat)+81 System.Web.Providers.DefaultMembershipProvider.ValidateUser(String username,String password)+105 System.Web.Security.Membership.ValidateUser(String username,String password)+26 Staff.Web.Account.Login.OnAuthenticate(Object sender,AuthenticateEventArgs e)位于c:\ Assembla \ SVN \ servicesdue \ Staff.Web \ Staff。 Web \ Account \ Login.aspx.cs:28 System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e)+9449786 System.Web.UI.WebControls.Login.AttemptLogin()+119 System.Web.UI.WebControls.Login.OnBubbleEvent(Object source,EventArgs e)+75 System.Web.UI.Control.RaiseBubbleEvent(Object source,EventArgs args)+37 System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)+114 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)+159 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)+10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,String eventArgument)+13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)+35 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)+1724

版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET版本:4.0.30319.18055

有人也有这个错误,他们说他们使用错误的商店连接到DB,因此错误。我的代码中只有一个商店。没有别的。

更新:

我发现了这个问题。它与会员有关。我的会员连接字符串有些不对劲。但我不知道是什么。我的应用需要注册才能启用身份验证。我单独保留默认设置。还在App_Data文件夹中发布了mdf文件。这里有一个类似的问题:Deploying ASP.NET membership to Godaddy。但解决方案尚不清楚,答案是明确的。我添加到连接字符串,我看到错误

在应用程序配置中找不到连接名称“LocalSqlServer”,或者连接字符串为空。

所以我该怎么做?这个会员资格在当地完美运作。

更新:

我也试过这个建议Godaddy ASP.NET membership database woes。我删除了conn字符串并添加了名称“LocalSqlServer”以使Godaddy高兴。然后我删除并添加了以下connectionStringName - DefaultProfileProvider,DefaultMembershipProvider,DefaultRoleProvider和DefaultSessionProvider。仍然得到相同的系统错误找不到指定的文件。

asp.net membership
9个回答
25
投票

建立与SQL Server的连接时发生与网络相关或特定于实例的错误。服务器未找到或无法访问。文本

通常这类问题与以下任何需要关注的问题有关:

  • 从Web服务器到数据库服务器的防火墙设置
  • 连接字符串错误
  • 启用适当的协议管道/ tcp-ip

尝试使用安装了sql server的系统上的sql管理服务器连接到sql server并从那里开始工作。注意错误日志中的信息。


9
投票

将项目发布到物理服务器后,我收到了同样的错误。当我在VS2013上编译时,我的Web应用程序在我的计算机上完美运行。当我检查sql server manager上的连接字符串时,一切都在服务器上运行良好。我还检查了防火墙(我把它关了)。但仍然没有奏效。我远程尝试通过SQL管理器连接数据库与完全相同的用户/传递和实例名称等与协议管道/ tcp,我看到一切正常。但是当我尝试打开网站时,我收到了这个错误。有没有人知道解决这个问题的第四个选项?

注意:我的应用程序:ASP.NET 4.5 (by VS2013),服务器:Windows 2008 R2 64bit,SQL:MS-SQL WEB 2012 SP1此外,其他Web应用程序在Web浏览器上运行良好,其数据库位于同一服务器上。


经过一天的痛苦,我找到了我的问题的解决方案:

首先,我检查了所有日志和其他细节,但我找不到任何东西。我突然意识到了这一点;当我尝试使用连接字符串直接连接到已发布的数据库并通过VS2013在我的计算机上运行应用程序时,我看到它正在连接另一个数据库文件。我检查了本地目录,然后找到了它。 ASP.NET身份不使用我在web.config文件中写的连接字符串。因此,VS2013在App_Data文件夹中创建或连接名为“DefaultConnection.mdf”的新数据库。然后我找到了解决方案,它在IdentityModel.cs中。

我改变了代码:

public class ApplicationUser : IdentityUser
{
}

public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
    //public ApplicationDbContext() : base("DefaultConnection") ---> this was original
    public ApplicationDbContext() : base("<myConnectionStringNameInWebConfigFile>") //--> changed
    {
    }
}

所以,毕竟,我重新构建并发布了我的项目,现在一切正常:)


1
投票

如果在部署.Net MVC Web应用程序后在GoDaddy中遇到此错误...并且您的web.config绝对正确...右键单击您的数据项目选择设置并确保正在使用GoDaddy服务器的正确连接字符串


1
投票

我遇到了同样的问题 - 对我而言,SQL Server内存不足。释放一些记忆解决了这个问题


0
投票

'/'应用程序中的服务器错误。

该系统找不到指定的文件

描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.ComponentModel.Win32Exception:系统找不到指定的文件

来源错误:

     {
                   SqlCommand cmd = new SqlCommand("select * from tblemployee",con);
                   con.Open();
                   GridView1.DataSource = cmd.ExecuteReader();
                   GridView1.DataBind();

源文件:d:\ C#programs \ kudvenkat \ adobasics1 \ adobasics1 \ employeedata.aspx.cs行:23

如果你的错误与我的错误相同......就这样做

右键单击sqlserver对象资源管理器中的表,在左下角选择属性一般选项中有一个带服务器和连接规范的连接块。在你的web配置中为datasource =。或本地选择属性中的服务器中指定的名称..


0
投票

我在启动ASP.NET应用程序时遇到此错误,在我的情况下,问题是SQL Server服务未运行。从那开始清理它。


0
投票

启动sql server代理,这应该可以解决您的问题


0
投票

考虑到LocalDb实例仅用于开发。 LocalDb不适用于生产服务器部署最终结果时。

我认为您的连接字符串指向LocalDb实例,您需要采取某些步骤将其转换为SQL Server数据库。这不仅仅是复制mdf文件的问题。它可能因托管公司而异,但通常需要创建现有数据库的备份(.bak文件),然后将其还原到托管公司的SQL Server。您应该询问他们在哪里可以找到有关将数据库部署到生产环境中的说明。


-1
投票

最常见的原因可能是数据库连接字符串。您必须更改连接字符串attachDBFile = | DataDirectory | file_name.mdf。主机名可能存在问题,可能是(本地),localhost或。\ sqlexpress。

© www.soinside.com 2019 - 2024. All rights reserved.