0

我有一个 .NET Core 命令行应用程序,我已将其作为 Web 作业部署到 Azure。
当我尝试访问应用程序中的数据库时,我收到以下错误消息:

[10/05/2016 06:23:27 > 5c77b6: ERR ] Unhandled Exception: System.AggregateException: One or more errors occurred. (Unable to load DLL 'sni.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)) ---> System.DllNotFoundException: Unable to load DLL 'sni.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at System.Data.SqlClient.SNINativeMethodWrapper.UnmanagedIsTokenRestricted(IntPtr token, Boolean& isRestricted)
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at System.Data.Win32NativeMethods.IsTokenRestrictedWrapper(IntPtr token)
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at System.Data.ProviderBase.DbConnectionPoolIdentity.GetCurrent()
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at System.Data.ProviderBase.DbConnectionPoolGroup.GetConnectionPool(DbConnectionFactory connectionFactory)
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPool(DbConnection owningObject, DbConnectionPoolGroup connectionPoolGroup)
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at System.Data.SqlClient.SqlConnection.Open()
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open()
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable.Enumerator.MoveNext()
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.<_ShapedQuery>d__3`1.MoveNext()
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.<_TrackEntities>d__15`2.MoveNext()
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at CommerceVision.InteractivePurchasingModule.Workflow.DuplicateCheckWorkflowProcessor.<GetUnProcessedEmails>d__4.MoveNext()
[10/05/2016 06:23:27 > 5c77b6: ERR ] --- End of stack trace from previous location where exception was thrown ---
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at CommerceVision.InteractivePurchasingModule.Workflow.DuplicateCheckWorkflowStep.<Process>d__7.MoveNext()
[10/05/2016 06:23:27 > 5c77b6: ERR ] --- End of stack trace from previous location where exception was thrown ---
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at CommerceVision.InteractivePurchasingModule.Workflow.WorkflowEngine.<Execute>d__3.MoveNext()
[10/05/2016 06:23:27 > 5c77b6: ERR ] --- End of stack trace from previous location where exception was thrown ---
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at CommerceVision.IpWorkflowProcessor.Program.<>c.<<ConfigureApplication>b__19_2>d.MoveNext()
[10/05/2016 06:23:27 > 5c77b6: ERR ]    --- End of inner exception stack trace ---
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
[10/05/2016 06:23:27 > 5c77b6: ERR ]    at CommerceVision.IpWorkflowProcessor.Program.Main(String[] args)


不确定是否有其他人遇到过同样的问题并找到解决方法或修复它。在过去的两天里,我一直在尝试解决这个问题,但没有成功。
谢谢。

4

2 回答 2

1

好的,我发现了问题。有2个问题。

1.您需要确保您在 Project.json 中有以下内容:

"Microsoft.NETCore.App": {
        "version": "1.0.0",
        "type": "platform"
    },

我的没有“类型”:“平台”部分。

  1. 主要的是您需要在项目的根目录中有一个名为 run.cmd 的文件,并将其包含在您的发布输出中:

    @echo 关闭 dotnet NameOfYourProject.dll 进程

这些更改后一切正常。希望这将有助于其他人并节省他们的时间。

于 2016-10-06T01:18:56.810 回答
0

和我一样,我变了。

"frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  }

至。

"frameworks": {
    "netcoreapp1.1": {
      "imports": [
        "dotnet5.6",
        "dnxcore50",
        "portable-net45+win8"
      ],
      "dependencies": {
        "Microsoft.NETCore.App": {
          "version": "1.1.0",
          "type": "platform"
        }
      }
    }
  },
于 2017-01-29T10:00:50.843 回答