gpt4 book ai didi

asp.net-core-2.0 - 将 ASP.Net Core 2.1preview2 网站发布到本地 IIS MSB3030 *.PrecompiledViews.dll

转载 作者:行者123 更新时间:2023-12-05 00:47:53 30 4
gpt4 key购买 nike

更新 1

根据@Priyesh Kumar 的反馈,我使用了网站根文件夹中的以下命令(网站带有 *.csproj 的那个)。这奏效了。然后我将“win10-x64”内容文件复制到 c:\www\sigex.com。

 dotnet publish -c Release -r win10-x64 --self-contained

我现在遇到了一些不同的问题,但会修复它们,然后发回解决方案。

原帖

嗨,我正在尝试将我的网站本地发布到 IIS(我在 IIS 管理器中创建的站点)。我在 Visual Studio 中使用右键单击发布选项。

在 IIS 管理器中,我的设置是;

enter image description here

对于应用程序池,我有以下内容

enter image description here

当我单击“发布”并选择“IIS、FTP 等”并单击“发布”时。然后我将设置输入为“发布方法:文件系统”。我将目标位置设置为“C:\www\sigex.com”。我在“c:\windows\system32\drivers\etc\hosts”文件中使用了“127.0.0.1 sigex.com”来在本地使用这个域(工作正常)。

发布设置如下所示;

enter image description here
enter image description here

设置发布配置后,我收到以下警报框;

enter image description here

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://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 目标,但这没有区别。请帮忙。

最佳答案

尝试使用 dotnet cli 命令发布

  • dotnet publish -c Release -r win10-x64 --self-contained

  • -c: Publish configuration, Release|Debug

    -r: Targeted runtime environment. Full list here

    --self-contained: Downloads and created a self contained package which can be run without dotnet sdk.


  • 复制文件夹 bin/Release/netcoreapp2.1/win10-x64/publish ,其中 web.config 存在于您的
    部署地点。
  • 确保安装 Dotnet 核心 hosting bundle对于 IIS。
  • 重启 IIS
  • 使用 .NET CLR 版本创建一个新池为 No Managed Code
  • 授予对 IIS_IUSRS 的读/写权限和 IUSR .
  • 使用上述应用程序池和代码位置创建新网站。

  • 阅读官方 docs .

    您可能也对 CORS 感兴趣。从 here 安装 IIS cors .

    注意:所有版本都特定于 OP 的系统。确保更换版本。
    注意:确保您已更新 Visual Studio 以支持 dotnet 核心

    关于asp.net-core-2.0 - 将 ASP.Net Core 2.1preview2 网站发布到本地 IIS MSB3030 *.PrecompiledViews.dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50668728/

    30 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com