Azure Webjob:无法加载'System.Net.Http'

时间:2017-04-27 14:41:05

标签: azure-webjobs

我收到以下错误:

[04/27/2017 14:18:56 > 2dcb9f: INFO] Warning: Only got partial types from assembly: WebJob2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[04/27/2017 14:18:56 > 2dcb9f: INFO] Exception message: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at System.Reflection.RuntimeModule.GetTypes()
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at System.Reflection.Assembly.GetTypes()
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at Microsoft.Azure.WebJobs.Host.Indexers.DefaultTypeLocator.FindTypes(Assembly assembly, IEnumerable`1 extensionAssemblies)
[04/27/2017 14:18:56 > 2dcb9f: INFO] Warning: Only got partial types from assembly: WebJob2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
[04/27/2017 14:18:56 > 2dcb9f: INFO] Exception message: System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at System.Reflection.RuntimeModule.GetTypes()
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at System.Reflection.Assembly.GetTypes()
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at Microsoft.Azure.WebJobs.Host.Indexers.DefaultTypeLocator.FindTypes(Assembly assembly, IEnumerable`1 extensionAssemblies)
[04/27/2017 14:18:56 > 2dcb9f: INFO] Error indexing method 'Functions.ProcessCopyProjectQueueMessage'
[04/27/2017 14:18:56 > 2dcb9f: INFO] Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException: Error indexing method 'Functions.ProcessCopyProjectQueueMessage' ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
[04/27/2017 14:18:56 > 2dcb9f: INFO]    --- End of inner exception stack trace ---
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, Boolean inherit)
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at System.Reflection.RuntimeMethodInfo.GetCustomAttributes(Type attributeType, Boolean inherit)
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at System.Attribute.GetCustomAttributes(MemberInfo element, Type type, Boolean inherit)
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, Boolean inherit)
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](MemberInfo element)
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at Microsoft.Azure.WebJobs.Host.TypeUtility.IsAsync(MethodInfo methodInfo)
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at Microsoft.Azure.WebJobs.Host.TypeUtility.IsAsyncVoid(MethodInfo methodInfo)
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.<IndexMethodAsyncCore>d__14.MoveNext()
[04/27/2017 14:18:56 > 2dcb9f: INFO] --- End of stack trace from previous location where exception was thrown ---
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.<IndexMethodAsync>d__13.MoveNext()
[04/27/2017 14:18:56 > 2dcb9f: INFO]    --- End of inner exception stack trace ---
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.<IndexMethodAsync>d__13.MoveNext()
[04/27/2017 14:18:56 > 2dcb9f: INFO] --- End of stack trace from previous location where exception was thrown ---
[04/27/2017 14:18:56 > 2dcb9f: INFO]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[04/27/2017 14:18:57 > 2dcb9f: INFO]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[04/27/2017 14:18:57 > 2dcb9f: INFO]    at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.<IndexTypeAsync>d__9.MoveNext()
[04/27/2017 14:18:57 > 2dcb9f: ERR ] 
[04/27/2017 14:18:57 > 2dcb9f: ERR ] Unhandled Exception: Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException: Error indexing method 'Functions.ProcessCopyProjectQueueMessage' ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    --- End of inner exception stack trace ---
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeMethodInfo method, RuntimeType caType, Boolean inherit)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Reflection.RuntimeMethodInfo.GetCustomAttributes(Type attributeType, Boolean inherit)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Attribute.GetCustomAttributes(MemberInfo element, Type type, Boolean inherit)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, Boolean inherit)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](MemberInfo element)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at Microsoft.Azure.WebJobs.Host.TypeUtility.IsAsync(MethodInfo methodInfo)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at Microsoft.Azure.WebJobs.Host.TypeUtility.IsAsyncVoid(MethodInfo methodInfo)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.<IndexMethodAsyncCore>d__14.MoveNext()
[04/27/2017 14:18:57 > 2dcb9f: ERR ] --- End of stack trace from previous location where exception was thrown ---
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.<IndexMethodAsync>d__13.MoveNext()
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    --- End of inner exception stack trace ---
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.<IndexMethodAsync>d__13.MoveNext()
[04/27/2017 14:18:57 > 2dcb9f: ERR ] --- End of stack trace from previous location where exception was thrown ---
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexer.<IndexTypeAsync>d__9.MoveNext()
[04/27/2017 14:18:57 > 2dcb9f: ERR ] --- End of stack trace from previous location where exception was thrown ---
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexProvider.<CreateAsync>d__11.MoveNext()
[04/27/2017 14:18:57 > 2dcb9f: ERR ] --- End of stack trace from previous location where exception was thrown ---
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexProvider.<GetAsync>d__10.MoveNext()
[04/27/2017 14:18:57 > 2dcb9f: ERR ] --- End of stack trace from previous location where exception was thrown ---
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at Microsoft.Azure.WebJobs.Host.Executors.JobHostContextFactory.<CreateAndLogHostStartedAsync>d__5.MoveNext()
[04/27/2017 14:18:57 > 2dcb9f: ERR ] --- End of stack trace from previous location where exception was thrown ---
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at Microsoft.Azure.WebJobs.Host.Executors.JobHostContextFactory.<CreateAndLogHostStartedAsync>d__4.MoveNext()
[04/27/2017 14:18:57 > 2dcb9f: ERR ] --- End of stack trace from previous location where exception was thrown ---
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at Microsoft.Azure.WebJobs.JobHost.<CreateContextAndLogHostStartedAsync>d__44.MoveNext()
[04/27/2017 14:18:57 > 2dcb9f: ERR ] --- End of stack trace from previous location where exception was thrown ---
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at Microsoft.Azure.WebJobs.JobHost.<StartAsyncCore>d__27.MoveNext()
[04/27/2017 14:18:57 > 2dcb9f: ERR ] --- End of stack trace from previous location where exception was thrown ---
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at Microsoft.Azure.WebJobs.JobHost.Start()
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at Microsoft.Azure.WebJobs.JobHost.RunAndBlock()
[04/27/2017 14:18:57 > 2dcb9f: ERR ]    at WebJob2.Program.Main() in d:\a\1\s\WebJob2\Program.cs:line 33
[04/27/2017 14:18:57 > 2dcb9f: SYS ERR ] Job failed due to exit code -532462766
[04/27/2017 14:18:57 > 2dcb9f: SYS INFO] Process went down, waiting for 60 seconds
[04/27/2017 14:18:57 > 2dcb9f: SYS INFO] Status changed to PendingRestart
[04/27/2017 14:18:59 > 2dcb9f: SYS INFO] Detected WebJob file/s were updated, refreshing WebJob
[04/27/2017 14:18:59 > 2dcb9f: SYS INFO] Status changed to Stopping
[04/27/2017 14:19:00 > 2dcb9f: SYS INFO] Status changed to Stopped

Package.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="EntityFramework" version="6.1.3" targetFramework="net452" />
  <package id="Microsoft.Azure.KeyVault.Core" version="2.0.4" targetFramework="net452" />
  <package id="Microsoft.Azure.WebJobs" version="2.0.0" targetFramework="net452" />
  <package id="Microsoft.Azure.WebJobs.Core" version="2.0.0" targetFramework="net452" />
  <package id="Microsoft.Azure.WebJobs.Extensions" version="2.0.0" targetFramework="net452" />
  <package id="Microsoft.Data.Edm" version="5.8.2" targetFramework="net452" />
  <package id="Microsoft.Data.OData" version="5.8.2" targetFramework="net452" />
  <package id="Microsoft.Data.Services.Client" version="5.8.2" targetFramework="net452" />
  <package id="Microsoft.Tpl.Dataflow" version="4.5.24" targetFramework="net452" />
  <package id="Microsoft.Web.WebJobs.Publish" version="1.0.13" targetFramework="net46" />
  <package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.3" targetFramework="net452" />
  <package id="ncrontab" version="3.3.0" targetFramework="net452" />
  <package id="Newtonsoft.Json" version="10.0.2" targetFramework="net452" />
  <package id="System.ComponentModel.EventBasedAsync" version="4.3.0" targetFramework="net452" />
  <package id="System.Dynamic.Runtime" version="4.3.0" targetFramework="net452" />
  <package id="System.Linq.Queryable" version="4.3.0" targetFramework="net452" />
  <package id="System.Net.Requests" version="4.3.0" targetFramework="net452" />
  <package id="System.Spatial" version="5.8.2" targetFramework="net452" />
  <package id="WindowsAzure.Storage" version="8.1.1" targetFramework="net452" />
</packages>

我甚至尝试将CopyLocal设置为True。但是,这些都不起作用。我仍然遇到上述错误,webjobs处于持续的PendingRestart状态。

注意: webjob甚至不在本地工作。目标版本是.Net 4.6.1

0 个答案:

没有答案