我有一个.NET Core命令行应用程序,我已作为webjob部署到Azure。
当我尝试在应用程序,我收到以下错误消息来访问数据库:
无法在azure Webjob中加载sni.dll
[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)
不知道是否有人有同样的问题,并找到解决方法或修复它。过去两天我一直试图解决这个问题,但没有成功。
谢谢。
你能清理一下你的格式吗? – evilSnobu
请参阅[本页](https://github.com/projectkudu/kudu/wiki/Isolating-WebJobs-and-Deployment-script-issues)以获取隔离的初始步骤。 –