c#: System.MissingMethodException: Method not found

用C#开发项目,调试运行没有问题,但是发布到Azure中,则产生以下错误:


System.AggregateException: One or more errors occurred. \-\-\-> System.MissingMethodException: Method not found: 'System.IO.Stream AzureBaseLib.UBPIBlobClient.DownLoadToStream(System.Uri, System.IO.Stream)'.\r\n   at ubigdataplatform.demo.demoapi.<>c__DisplayClass4.<queryTrajectoryBySpacialAndTime>b__3(Uri uri)\r\n   at System.Threading.Tasks.Parallel.<>c__DisplayClass31_0`2.<ForEachWorker>b__0(Int32 i)\r\n   at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()\r\n   at System.Threading.Tasks.Task.InnerInvoke()\r\n   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)\r\n   at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )\r\n   \-\-\- End of inner exception stack trace \-\-\-\r\n   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)\r\n   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)\r\n   at System.Threading.Tasks.Task.Wait()\r\n   at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)\r\n   at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IList`1 list, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)\r\n   at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally)\r\n   at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, Action`1 body)\r\n   at ubigdataplatform.demo.demoapi.queryTrajectoryBySpacialAndTime(Double lat1, Double lat2, Double lng1, Double lng2, DateTime startTime, DateTime endTime)\r\n   at ubigdataplatform.demo.demoapi.Page_Load(Object sender, EventArgs e)\r\n\-\-\-> (Inner Exception #0) System.MissingMethodException: Method not found: 'System.IO.Stream AzureBaseLib.UBPIBlobClient.DownLoadToStream(System.Uri, System.IO.Stream)'.\r\n   at ubigdataplatform.demo.demoapi.<>c__DisplayClass4.<queryTrajectoryBySpacialAndTime>b__3(Uri uri)\r\n   at System.Threading.Tasks.Parallel.<>c__DisplayClass31_0`2.<ForEachWorker>b__0(Int32 i)\r\n   at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()\r\n   at System.Threading.Tasks.Task.InnerInvoke()\r\n   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)\r\n   at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )<\-\-\-\r\n\r\n\-\-\-> (Inner Exception #1) System.MissingMethodException: Method not found: 'System.IO.Stream AzureBaseLib.UBPIBlobClient.DownLoadToStream(System.Uri, System.IO.Stream)'.\r\n   at ubigdataplatform.demo.demoapi.<>c__DisplayClass4.<queryTrajectoryBySpacialAndTime>b__3(Uri uri)\r\n   at System.Threading.Tasks.Parallel.<>c__DisplayClass31_0`2.<ForEachWorker>b__0(Int32 i)\r\n   at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()\r\n   at System.Threading.Tasks.Task.InnerInvoke()\r\n   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)\r\n   at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )<\-\-\-\r\n\r\n\-\-\-> (Inner Exception #2) System.MissingMethodException: Method not found: 'System.IO.Stream AzureBaseLib.UBPIBlobClient.DownLoadToStream(System.Uri, System.IO.Stream)'.\r\n   at ubigdataplatform.demo.demoapi.<>c__DisplayClass4.<queryTrajectoryBySpacialAndTime>b__3(Uri uri)\r\n   at System.Threading.Tasks.Parallel.<>c__DisplayClass31_0`2.<ForEachWorker>b__0(Int32 i)\r\n   at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()\r\n   at System.Threading.Tasks.Task.InnerInvoke()\r\n   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)\r\n   at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )<\-\-\-\r\n\r\n\-\-\-> (Inner Exception #3) System.MissingMethodException: Method not found: 'System.IO.Stream AzureBaseLib.UBPIBlobClient.DownLoadToStream(System.Uri, System.IO.Stream)'.\r\n   at ubigdataplatform.demo.demoapi.<>c__DisplayClass4.<queryTrajectoryBySpacialAndTime>b__3(Uri uri)\r\n   at System.Threading.Tasks.Parallel.<>c__DisplayClass31_0`2.<ForEachWorker>b__0(Int32 i)\r\n   at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()\r\n   at System.Threading.Tasks.Task.InnerInvoke()\r\n   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)\r\n   at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )<\-\-\-\r\n\r\n\-\-\-> (Inner Exception #4) System.MissingMethodException: Method not found: 'System.IO.Stream AzureBaseLib.UBPIBlobClient.DownLoadToStream(System.Uri, System.IO.Stream)'.\r\n   at ubigdataplatform.demo.demoapi.<>c__DisplayClass4.<queryTrajectoryBySpacialAndTime>b__3(Uri uri)\r\n   at System.Threading.Tasks.Parallel.<>c__DisplayClass31_0`2.<ForEachWorker>b__0(Int32 i)\r\n   at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()\r\n   at System.Threading.Tasks.Task.InnerInvoke()\r\n   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)\r\n   at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )<\-\-\-\r\n\r\n\-\-\-> (Inner Exception #5) System.MissingMethodException: Method not found: 'System.IO.Stream AzureBaseLib.UBPIBlobClient.DownLoadToStream(System.Uri, System.IO.Stream)'.\r\n   at ubigdataplatform.demo.demoapi.<>c__DisplayClass4.<queryTrajectoryBySpacialAndTime>b__3(Uri uri)\r\n   at System.Threading.Tasks.Parallel.<>c__DisplayClass31_0`2.<ForEachWorker>b__0(Int32 i)\r\n   at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()\r\n   at System.Threading.Tasks.Task.InnerInvoke()\r\n   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)\r\n   at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )<\-\-\-\r\n\r\n\-\-\-> (Inner Exception #6) System.MissingMethodException: Method not found: 'System.IO.Stream AzureBaseLib.UBPIBlobClient.DownLoadToStream(System.Uri, System.IO.Stream)'.\r\n   at ubigdataplatform.demo.demoapi.<>c__DisplayClass4.<queryTrajectoryBySpacialAndTime>b__3(Uri uri)\r\n   at System.Threading.Tasks.Parallel.<>c__DisplayClass31_0`2.<ForEachWorker>b__0(Int32 i)\r\n   at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()\r\n   at System.Threading.Tasks.Task.InnerInvoke()\r\n   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)\r\n   at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )<\-\-\-\r\n\r\n\-\-\-> (Inner Exception #7) System.MissingMethodException: Method not found: 'System.IO.Stream AzureBaseLib.UBPIBlobClient.DownLoadToStream(System.Uri, System.IO.Stream)'.\r\n   at ubigdataplatform.demo.demoapi.<>c__DisplayClass4.<queryTrajectoryBySpacialAndTime>b__3(Uri uri)\r\n   at System.Threading.Tasks.Parallel.<>c__DisplayClass31_0`2.<ForEachWorker>b__0(Int32 i)\r\n   at System.Threading.Tasks.Parallel.<>c__DisplayClass17_0`1.<ForWorker>b__1()\r\n   at System.Threading.Tasks.Task.InnerInvoke()\r\n   at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)\r\n   at System.Threading.Tasks.Task.<>c__DisplayClass176_0.<ExecuteSelfReplicating>b__0(Object )<\-\-\-\r\n""}


大体意思就是某个方法不存在。但是我方法的确存在。


纠结了一番,并查阅了相关网页,初步认定是某个AzureBaseLib.dll文件过期所致。这个文件是我自己的项目文件,当前类型为Console Application。此前运行的项目引用了这个项目。


我分别做了以下的操作,均无效:


1、clean,rebuild。无效

2、重启vs,无效。

3、我的项目为.net 4.5,Azure运行环境为.net 4.6,是不是这个的问题?但是azure没有调整为.net4.6的选项,放弃。


最后一个偶然,将AzureBaseLib项目输出类型改成Class Library,发布,成功!

0 条评论

    发表评论

    电子邮件地址不会被公开。 必填项已用 * 标注