Firoly 2017-01-12 05:40 采纳率: 50%
浏览 2813
已采纳

我在Vs中写了一个webApi,把它部署到iis10之后会出现以下错误,有没有大神帮我看一下?

{"Message":"出现错误。","ExceptionMessage":"在与 SQL Server 建立连接时出现与网络相关的或特定于实例的错误。未找到或无法访问服务器。请验证实例名称是否正确并且 SQL Server 已配置为允许远程连接。 (provider: SQL Network Interfaces, error: 50 - 发生了 Local Database Runtime 错误。无法创建自动实例。有关错误详细信息,请参阅 Windows 应用程序事件日志。\r\n)","ExceptionType":"System.Data.SqlClient.SqlException","StackTrace":" 在 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling)\r\n 在 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)\r\n 在 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions)\r\n 在 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)\r\n 在 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection)\r\n 在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection)\r\n 在 System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection)\r\n 在 System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)\r\n 在 System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions)\r\n 在 System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 retry)\r\n 在 System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource1 retry)\r\n 在 System.Data.SqlClient.SqlConnection.Open()\r\n 在 System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.DispatchTTarget,TInterceptionContext\r\n 在 System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher.Open(DbConnection connection, DbInterceptionContext interceptionContext)\r\n 在 System.Data.Entity.SqlServer.SqlProviderServices.<>c__DisplayClass33.b__32()\r\n 在 System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.<>c__DisplayClass1.b__0()\r\n 在 System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.ExecuteTResult\r\n 在 System.Data.Entity.SqlServer.SqlProviderServices.UsingMasterConnection(DbConnection sqlConnection, Action1 act)\r\n 在 System.Data.Entity.SqlServer.SqlProviderServices.CreateDatabaseFromScript(Nullable1 commandTimeout, DbConnection sqlConnection, String createDatabaseScript)\r\n 在 System.Data.Entity.SqlServer.SqlProviderServices.DbCreateDatabase(DbConnection connection, Nullable1 commandTimeout, StoreItemCollection storeItemCollection)\r\n 在 System.Data.Entity.Migrations.Utilities.DatabaseCreator.Create(DbConnection connection)\r\n 在 System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase)\r\n 在 System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration)\r\n 在 System.Data.Entity.Internal.DatabaseCreator.CreateDatabase(InternalContext internalContext, Func3 createMigrator, ObjectContext objectContext)\r\n 在 System.Data.Entity.Database.Create(DatabaseExistenceState existenceState)\r\n 在 System.Data.Entity.CreateDatabaseIfNotExists1.InitializeDatabase(TContext context)\r\n 在 System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action)\r\n 在 System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization()\r\n 在 System.Data.Entity.Internal.RetryAction1.PerformAction(TInput input)\r\n 在 System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action1 action)\r\n 在 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)\r\n 在 System.Data.Entity.Internal.Linq.InternalSet1.Initialize()\r\n 在 System.Data.Entity.Internal.Linq.InternalSet1.get_InternalContext()\r\n 在 System.Data.Entity.Infrastructure.DbQuery1.System.Linq.IQueryable.get_Provider()\r\n 在 System.Linq.Queryable.SelectTSource,TResult\r\n 在 WebApi1111250.Controllers.DataModelsController.GetDataModels() 位置 c:\Users\李昊阳\Documents\Visual Studio 2013\Projects\WebApi1111250\WebApi1111250\Controllers\DataModelsController.cs:行号 40\r\n 在 lambda_method(Closure , Object , Object[] )\r\n 在 System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.b__9(Object instance, Object[] methodParameters)\r\n 在 System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- 引发异常的上一位置中堆栈跟踪的末尾 ---\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n 在 System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext()\r\n--- 引发异常的上一位置中堆栈跟踪的末尾 ---\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n 在 System.Web.Http.Controllers.ActionFilterResult.d__2.MoveNext()\r\n--- 引发异常的上一位置中堆栈跟踪的末尾 ---\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n 在 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n 在 System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()"}

  • 写回答

5条回答 默认 最新

  • Young-Eric 2017-01-12 05:50
    关注

    李昊阳同学,我估计问题可能有以下几种情况,你在本地连接应该可以吧,那就是线上配置问题
    1:数据库相关服务没启动
    2:权限问题
    3:配置文件连接字符串不对

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?