Update 1
根据 @Priyesh Kumar 的反馈,我使用了网站根文件夹中的以下命令(网站带有 *.csproj 的命令)。这有效。然后我将“win10-x64”内容文件复制到 c:\www\sigex.com 中。
dotnet publish -c Release -r win10-x64 --self-contained
我现在遇到了一些不同的问题,但会修复它们,然后发回解决方案。
原帖
您好,我正在尝试将我的网站本地发布到 IIS(我在 IIS 管理器中创建的网站)。我在 Visual Studio 中使用右键单击发布选项。
在 IIS 管理器中我的设置是;
对于应用程序池我有以下内容
当我单击“发布”并选择“IIS、FTP 等”并单击“发布”时。然后,我将设置输入为“发布方法:文件系统”。我将目标位置设置为“C:\www\sigex.com”。我已在“c:\windows\system32\drivers\etc\hosts”文件中使用“127.0.0.1 sigex.com”在本地使用此域(工作正常)。
发布设置如下所示;
设置发布配置后,我收到以下警报框;
tmp 文件内有以下内容;
03/06/2018 17:10:54
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__DisplayClass41_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__116.MoveNext()
---> (Inner Exception #0) System.Exception: Build failed. Check the Output window for more details.<---
===================
在“网络发布活动”中我得到以下内容;
https://pastebin.com/QRsvhTHU https://pastebin.com/QRsvhTHU
任何人都可以帮助我解决我哪里出错了吗?我在这里找到了这篇文章,其中说他们遇到了同样的问题。
https://github.com/dotnet/core/issues/1039 https://github.com/dotnet/core/issues/1039
然而他们说这只会发生在
<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
在 *.csproj 中设置。我的 *.csproj 中没有上述内容
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<UserSecretsId>aspnet-Onion.Website-23EA0CB5-7C55-42E5-80E3-8CD26CCDBA6C</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.0-preview1-final" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.0-preview1-final" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.0-preview1-final" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<!-- obsolete references -->
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.1.0-preview1-final" />
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.1.0-preview1-final" />
<!--<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.1.0-preview1-final" />-->
<!--<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.2" />-->
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.1.0-preview1-final" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Onion.Repositories\Onion.Repositories.csproj" />
<ProjectReference Include="..\Onion.Services\Onion.Services.csproj" />
</ItemGroup>
</Project>
我尝试选择 x86 作为 cpu 目标,但这没有什么区别。请帮忙。