【问题标题】:Unable to launch web app on IIS Server and client无法在 IIS 服务器和客户端上启动 Web 应用程序
【发布时间】: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) +156
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource
1 重试,DbConnectionOptions 用户选项、DbConnectionInternal oldConnection、DbConnectionInternal& 连接)+258
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection 外部连接,DbConnectionFactory 连接工厂, 任务完成源1 retry, DbConnectionOptions userOptions) +312
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource
1 重试)+202
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry) +413 System.Data.SqlClient.SqlConnection.Open() +128
System.Data.Entity.Infrastructure.Interception.InternalDispatcher
1.Dispatch(TTarget 目标,Action2 operation, TInterceptionContext interceptionContext, Action3 正在执行,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(Func
1 操作)+234
System.Data.Entity.SqlServer.SqlProviderServices.UsingMasterConnection(DbConnection sqlConnection, Action1 act) +927
System.Data.Entity.SqlServer.SqlProviderServices.CreateDatabaseFromScript(Nullable
1 commandTimeout, DbConnection sqlConnection, 字符串 createDatabaseScript) +124
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?

标签: c# selenium


【解决方案1】:

我怀疑您与数据库的连接字符串不正确,或者它连接的 SQL 服务器位于另一台未设置为接受远程连接的服务器上。

问候

【讨论】:

    【解决方案2】:

    我注释掉了这段代码,它工作了

     var migrator = new DbMigrator(new Configuration());
            migrator.Update();     
    

    【讨论】:

      猜你喜欢
      • 2015-05-14
      • 1970-01-01
      • 2011-07-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-04
      • 1970-01-01
      • 2011-09-04
      相关资源
      最近更新 更多