[英]Unable to launch web app on IIS Server and client
I cloned this web app from ExecuteAutoEmployee
in GitHub, but I can't launch it both from the client and from the IIS server then deployed. 我从GitHub的
ExecuteAutoEmployee
克隆了此Web应用程序 ,但无法同时从客户端和随后部署的IIS服务器启动它。 I am having the following issues: 我遇到以下问题:
The system cannot find the file specified Description: An unhandled exception occurred during the execution of the current web request.
系统找不到指定的文件说明:执行当前Web请求期间发生未处理的异常。 Please review the stack trace for more information about the error and where it originated in the code.
请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息。
Exception Details: System.ComponentModel.Win32Exception: The system cannot find the file specified
异常详细信息:System.ComponentModel.Win32Exception:系统找不到指定的文件
Source Error:
源错误:
Line 18: Line 19: var migrator = new DbMigrator(new Configuration());
第18行:第19行:var migrator = new DbMigrator(new Configuration()); Line 20: migrator.Update();
第20行:migrator.Update(); Line 21:
第21行:
Line 22:第22行:
Source File: D:\\Repositories\\ExecuteAutomationWebApp\\ExecuteAutoEmployee\\Global.asax.cs Line: 20
源文件:D:\\ Repositories \\ ExecuteAutomationWebApp \\ ExecuteAutoEmployee \\ Global.asax.cs行:20
Stack Trace:
堆栈跟踪:
[Win32Exception (0x80004005): The system cannot find the file specified]
[Win32Exception(0x80004005):系统找不到指定的文件]
[SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server.
[SqlException(0x80131904):建立与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.
验证实例名称正确,并且已将SQL Server配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]
(提供者:命名管道提供程序,错误:40-无法打开与SQL Server的连接)
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +345System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject,UInt32 waitForMultipleObjectsTimeout,Boolean allowCreate,only Boolean OneCheckConnection,DbConnectionOptions userOptions,DbConnectionInternal&connection)+345
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +156
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSourceSystem.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject,TaskCompletionSource
1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +156
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +156
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +156
1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +258
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +156
1重试,DbConnectionOptions userOptions,DbConnectionInternal oldConnection,DbConnectionInternal&连接)+258
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) +312
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSourceSystem.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection externalConnection,DbConnectionFactory connectionFactory,TaskCompletionSource
1 retry, DbConnectionOptions userOptions) +312
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 retry, DbConnectionOptions userOptions) +312
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 retry, DbConnectionOptions userOptions) +312
1 retry) +202
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 retry, DbConnectionOptions userOptions) +312
1重试)+202
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry) +413 System.Data.SqlClient.SqlConnection.Open() +128
System.Data.Entity.Infrastructure.Interception.InternalDispatcherSystem.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource
1 retry) +413 System.Data.SqlClient.SqlConnection.Open() +128
System.Data.Entity.Infrastructure.Interception.InternalDispatcher1 retry) +413 System.Data.SqlClient.SqlConnection.Open() +128
System.Data.Entity.Infrastructure.Interception.InternalDispatcher1 retry) +413 System.Data.SqlClient.SqlConnection.Open() +128
1.Dispatch(TTarget target, Action
System.Data.Entity.Infrastructure.Interception.InternalDispatcher2 operation, TInterceptionContext interceptionContext, Action
3 executing, Action3 executed) +104
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(Func1 retry) +413 System.Data.SqlClient.SqlConnection.Open() +128
1.Dispatch(TTarget目标,Action
System.Data.Entity.Infrastructure.Interception.InternalDispatcher2 operation, TInterceptionContext interceptionContext, Action
3执行,Action3 executed) +104
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(Func3 executed) +104
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(Func3 executed) +104
1 operation) +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(Func3 executed) +104
1操作)+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) +927
System.Data.Entity.SqlServer.SqlProviderServices.CreateDatabaseFromScript(NullableSystem.Data.Entity.SqlServer.SqlProviderServices.UsingMasterConnection(DbConnection sqlConnection,操作
1 act) +927
System.Data.Entity.SqlServer.SqlProviderServices.CreateDatabaseFromScript(Nullable1 act) +927
System.Data.Entity.SqlServer.SqlProviderServices.CreateDatabaseFromScript(Nullable1 act) +927
1 commandTimeout, DbConnection sqlConnection, String createDatabaseScript) +124
System.Data.Entity.SqlServer.SqlProviderServices.CreateDatabaseFromScript(Nullable1 act) +927
1 commandTimeout,DbConnection sqlConnection,字符串createDatabaseScript)+124
System.Data.Entity.SqlServer.SqlProviderServices.CreateDatabaseFromScript(Nullable
System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabase(DbConnection connection, Nullable`1 commandTimeout, StoreItemCollection storeItemCollection) +221System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabase(DbConnection连接,Nullable`1 commandTimeout,StoreItemCollection storeItemCollection)+221
System.Data.Entity.Migrations.Utilities.DatabaseCreator.Create(DbConnection connection) +125System.Data.Entity.Migrations.Utilities.DatabaseCreator.Create(DbConnection连接)+125
System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase) +156System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(动作mustSucceedToKeepDatabase)+156
System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration) +116System.Data.Entity.Migrations.DbMigrator.Update(字符串targetMigration)+116
ExecuteAutoEmployee.MvcApplication.Application_Start() in D:\\Repositories\\ExecuteAutomationWebApp\\ExecuteAutoEmployee\\Global.asax.cs:20D:\\ Repositories \\ ExecuteAutomationWebApp \\ ExecuteAutoEmployee \\ Global.asax.cs中的ExecuteAutoEmployee.MvcApplication.Application_Start():20
[HttpException (0x80004005): A network-related or instance-specific error occurred while establishing a connection to SQL Server.
[HttpException(0x80004005):建立与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.
验证实例名称正确,并且已将SQL Server配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]
(提供者:命名管道提供程序,错误:40-无法打开与SQL Server的连接)
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +520System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext上下文,HttpApplication应用程序)+520
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +176System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext,HttpContext上下文,MethodInfo []处理程序)+176
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +165System.Web.HttpApplication.InitSpecial(HttpApplicationState状态,MethodInfo []处理程序,IntPtr appContext,HttpContext上下文)+165
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +353System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext,HttpContext上下文)+353
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +341System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)+341
[HttpException (0x80004005): A network-related or instance-specific error occurred while establishing a connection to SQL Server.
[HttpException(0x80004005):建立与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.
验证实例名称正确,并且已将SQL Server配置为允许远程连接。 (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]
(提供者:命名管道提供程序,错误:40-无法打开与SQL Server的连接)
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +523System.Web.HttpRuntime.FirstRequestInit(HttpContext上下文)+523
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +107 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +688System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext上下文)+107 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext上下文)+688
Version Information: Microsoft .NET Framework Version:4.0.30319;
版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET Version:4.7.3056.0
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);
}
}
}
I suspect your connection string to your db is incorrect, or the SQL server it's connecting to is on another server that isn't setup to accept remote connections. 我怀疑您与数据库的连接字符串不正确,或者它所连接的SQL Server在另一台未设置为接受远程连接的服务器上。
Regards 问候
I commented out this bit of code and it worked 我注释掉了这段代码,它起作用了
var migrator = new DbMigrator(new Configuration());
migrator.Update();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.