【发布时间】:2018-07-01 12:10:07
【问题描述】:
我从 GitHub 中的 ExecuteAutoEmployee 克隆了 this web app,但我无法从客户端和随后部署的 IIS 服务器启动它。我遇到以下问题:
系统找不到指定的文件说明:未处理 执行当前 Web 请求期间发生异常。 请查看堆栈跟踪以获取有关错误的更多信息和 它起源于代码的地方。
异常详细信息:System.ComponentModel.Win32Exception:系统 找不到指定的文件
来源错误:
第 18 行:第 19 行:var migrator = new DbMigrator(new 配置());第 20 行:migrator.Update();第 21 行:
第 22 行:源文件: D:\Repositories\ExecuteAutomationWebApp\ExecuteAutoEmployee\Global.asax.cs 线路:20
堆栈跟踪:
[Win32Exception (0x80004005): 系统找不到文件 指定]
[SqlException (0x80131904): 网络相关或实例特定 建立与 SQL Server 的连接时出错。这 服务器未找到或无法访问。验证实例 名称正确且 SQL Server 配置为允许远程 连接。 (提供者:命名管道提供者,错误:40 - 无法 打开与 SQL Server 的连接)]
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean 允许创建、布尔型仅OneCheckConnection、DbConnectionOptions userOptions、DbConnectionInternal& 连接)+345
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject,TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1561 重试,DbConnectionOptions 用户选项、DbConnectionInternal oldConnection、DbConnectionInternal& 连接)+258
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection 外部连接,DbConnectionFactory 连接工厂, 任务完成源1 retry, DbConnectionOptions userOptions) +3121 重试)+202
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry) +413 System.Data.SqlClient.SqlConnection.Open() +1281.Dispatch(TTarget 目标,Action
System.Data.Entity.Infrastructure.Interception.InternalDispatcher2 operation, TInterceptionContext interceptionContext, Action3 正在执行,Action3 executed) +1041 操作)+234
System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext) +503
System.Data.Entity.SqlServer.<>c__DisplayClass33.<UsingConnection>b__32() +560 System.Data.Entity.SqlServer.<>c__DisplayClass1.<Execute>b__0() +18
System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute(Func
System.Data.Entity.SqlServer.SqlProviderServices.UsingMasterConnection(DbConnection sqlConnection, Action1 act) +9271 commandTimeout, DbConnection sqlConnection, 字符串 createDatabaseScript) +124
System.Data.Entity.SqlServer.SqlProviderServices.CreateDatabaseFromScript(Nullable
System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabase(DbConnection 连接,Nullable`1 commandTimeout,StoreItemCollection storeItemCollection) +221
System.Data.Entity.Migrations.Utilities.DatabaseCreator.Create(DbConnection 连接)+125
System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(操作 mustSucceedToKeepDatabase) +156
System.Data.Entity.Migrations.DbMigrator.Update(字符串 目标迁移)+116
执行AutoEmployee.MvcApplication.Application_Start() 在 D:\Repositories\ExecuteAutomationWebApp\ExecuteAutoEmployee\Global.asax.cs:20[HttpException (0x80004005): 网络相关或实例特定 建立与 SQL Server 的连接时出错。这 服务器未找到或无法访问。验证实例 名称正确且 SQL Server 配置为允许远程 连接。 (提供者:命名管道提供者,错误:40 - 无法 打开与 SQL Server 的连接)]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext 上下文,HttpApplication 应用程序)+520
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext、HttpContext 上下文、MethodInfo[] 处理程序)+176
System.Web.HttpApplication.InitSpecial(HttpApplicationState 状态, MethodInfo[] 处理程序、IntPtr appContext、HttpContext 上下文)+165
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext、HttpContext 上下文)+353
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +341[HttpException (0x80004005): 网络相关或实例特定 建立与 SQL Server 的连接时出错。这 服务器未找到或无法访问。验证实例 名称正确且 SQL Server 配置为允许远程 连接。 (提供者:命名管道提供者,错误:40 - 无法 打开与 SQL Server 的连接)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext 上下文) +523
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext 上下文) +107 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest WR,HttpContext 上下文)+688版本信息:Microsoft .NET Framework 版本:4.0.30319; ASP.NET 版本:4.7.3056.0
using ExecuteAutoEmployee.Migrations;
using System;
using System.Collections.Generic;
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace ExecuteAutoEmployee
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
var migrator = new DbMigrator(new Configuration());
migrator.Update();
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
}
}
【问题讨论】:
-
它试图连接到什么 SQL Server?