我正在玩.NET Core,我发现自己有点蠢。我有一个应用程序(ASP.NET核心Web应用程序),它打电话来搜索我的Dropbox帐户中的一些文件。调用是通过一堆层(不同的.net核心类库项目)最终到达最终项目,该项目引用Dropbox 3.4.1 API,实际调用Dropbox。
问题是抛出了波纹管异常。有趣的是,从.Net Core Console应用程序进行完全相同的调用就可以了。
这是Web应用程序的project.json:
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"System.Runtime.Serialization.Primitives": "4.1.1",
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"SyncPlayer.Common": "1.0.0-*",
"SyncPlayer.Domain": "1.0.0-*"
},
"tools": {
"BundlerMinifier.Core": "2.0.238",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
控制台应用程序的project.json:
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
},
"SyncPlayer.Common": "1.0.0-*",
"SyncPlayer.Domain": "1.0.0-*",
"SyncPlayer.Dropbox": "1.0.0-*",
"System.Runtime.Serialization.Primitives": "4.1.1-rc2-24027"
},
"frameworks": {
"netcoreapp1.0": {
"imports": "dnxcore50"
}
}
}
抛出异常的StackTrace:
System.IO.FileNotFoundException:无法加载文件或程序集'System,Version = 2.0.5.0,Culture = neutral,PublicKeyToken = 7cec85d7bea7798e,Retargetable = Yes'。该系统找不到指定的文件。 文件名:'System,Version = 2.0.5.0,Culture = neutral,PublicKeyToken = 7cec85d7bea7798e,Retargetable = Yes' 在Dropbox.Api.Files.SearchArg..ctor(String path,String query,UInt64 start,UInt64 maxResults,SearchMode mode) 在Dropbox.Api.Files.Routes.FilesRoutes.SearchAsync(String path,String query,UInt64 start,UInt64 maxResults,SearchMode mode) 在E:\ Projects \ SyncPlayer.Core \ SyncPlayer \ SyncPlayer.Dropbox \ DropboxClientWrapper.cs中的SyncPlayer.Dropbox.DropboxClientWrapper.d__4.MoveNext():第47行 ---从抛出异常的先前位置开始的堆栈跟踪结束--- 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在System.Runtime.CompilerServices.TaskAwaiter
1.GetResult() at SyncPlayer.Dropbox.DropboxDataStore.<SearchAsync>d__3.MoveNext() in E:\Projects\SyncPlayer.Core\SyncPlayer\SyncPlayer.Dropbox\DropboxDataStore.cs:line 27 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult() 在E:\ Projects \ SyncPlayer.Core \ SyncPlayer \ SyncPlayer.Dropbox \ Services \ DropboxFileFinderService.cs中的SyncPlayer.Dropbox.Services.DropboxFileFinderService.d__4.MoveNext()中:第28行 ---从抛出异常的先前位置开始的堆栈跟踪结束--- 在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任务任务) 在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任务任务) 在System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at SyncPlayer.Domain.FileFinderFacade.<FindAudioFileAsync>d__5.MoveNext() in E:\Projects\SyncPlayer.Core\SyncPlayer\SyncPlayer.Domain\FileFinderFacade.cs:line 27 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult() 在E:\ Projects \ SyncPlayer.Core \ SyncPlayer \ SyncPlayer.SPA \ Controllers \ HomeController.cs中的SyncPlayer.SPA.Controllers.HomeController.d__2.MoveNext():第18行
我可能错过了网络应用中的一些配置,任何想法?!