C# 仅在发布时生成失败

C# 仅在发布时生成失败,c#,deployment,visual-studio-2017,.net-core,publish,C#,Deployment,Visual Studio 2017,.net Core,Publish,我正在运行visual studio 2017,我正在尝试通过FTP将.net core 2.0项目部署到我的服务器。我的项目正常生成,但当我尝试发布时,出现错误: System.AggregateException:发生一个或多个错误。-->系统异常:生成失败。有关更多详细信息,请查看“输出”窗口。 ---内部异常堆栈跟踪的结束--- 在System.Threading.Tasks.Task.Wait(Int32毫秒计时,CancellationToken CancellationToken)

我正在运行visual studio 2017,我正在尝试通过FTP将.net core 2.0项目部署到我的服务器。我的项目正常生成,但当我尝试发布时,出现错误:

System.AggregateException:发生一个或多个错误。-->系统异常:生成失败。有关更多详细信息,请查看“输出”窗口。 ---内部异常堆栈跟踪的结束--- 在System.Threading.Tasks.Task.Wait(Int32毫秒计时,CancellationToken CancellationToken) 在Microsoft.VisualStudio.Web.Publish.PublishService.VsWebProjectPublish.c__DisplayClass40_0.b__2()上 在System.Threading.Tasks.Task`1.InnerInvoke()中 在System.Threading.Tasks.Task.Execute()中

此问题仅在我发布时发生。第三方DLL
Microsoft.AspNetCore.StaticFiles
System.IdentityModel.Tokens.Jwt


你知道我怎样才能让发布工作吗?

对于它的工作,我有完全相同的错误:

System.AggregateException: One or more errors occurred. ---> System.Exception: Build failed. Check the Output window for more details.
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Microsoft.VisualStudio.Web.Publish.PublishService.VsWebProjectPublish.<>c__DisplayClass43_0.<PublishAsync>b__2()
   at System.Threading.Tasks.Task`1.InnerInvoke()
   at System.Threading.Tasks.Task.Execute()
--- 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 Microsoft.VisualStudio.ApplicationCapabilities.Publish.ViewModel.ProfileSelectorViewModel.<RunPublishTaskAsync>d__127.MoveNext()
---> (Inner Exception #0) System.Exception: Build failed. Check the Output window for more details.<---

故事的寓意这个错误似乎指向了项目本身之外的东西。希望这对其他人有所帮助。

请查看位于您的Project\Properties\PublishProfiles中的FolderProfile.pubxml文件,并确保使用正确的版本配置了术语

对于VS2019和IIS 10,回收您正在部署的应用程序使用的应用程序池对我来说很有效。

这有点不寻常,但我发现publish确实尝试对某些类型的项目使用单独的设置文件。读取AppSettings时是否正在执行异步等待/任务?你有DependencyInjection框架设置吗?@BrettCaswell我所有的控制器都是异步的,但我不会手动读取allalso的应用程序设置。你是否尝试过本地版本的构建,以查看是否无法复制此设置?通常,我们在调试中构建和测试,并在发布中发布。由于指令的原因,可能存在您没有遇到的配置问题。更新我的visual studio为其他遇到此问题的人解决了此问题。我可以始终如一地发布的方法是,首先在本地发布到一个文件夹,然后手动将该文件夹ftp到服务器
2>Unable to add 'Scripts/jquery-3.4.1.js' to the Web site.  Unable to add file 'Scripts\jquery-3.4.1.js'.  There is not enough space on the disk.