将ASP.Net Core 2.1preview2网站发布到本地IIS MSB3030 *.PrecompiledViews.dll

2024-01-05

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


尝试使用 dotnet cli 命令发布

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

-c:发布配置,发布|调试

-r:目标运行时环境。完整列表here https://learn.microsoft.com/en-us/dotnet/core/rid-catalog

--self-contained:下载并创建一个独立的包,可以在没有 dotnet sdk 的情况下运行。

  1. 将文件夹复制到bin/Release/netcoreapp2.1/win10-x64/publish,其中 web.config 存在于您的 部署地点。
  2. 确保安装 Dotnet 核心托管捆绑包 https://www.microsoft.com/net/download/thank-you/dotnet-runtime-2.1.0-windows-hosting-bundle-installer对于 IIS。
  3. 重新启动 IIS
  4. 创建一个新池,其 .NET CLR 版本为No Managed Code
  5. 授予读/写权限IIS_IUSRS and IUSR.
  6. 使用上述应用程序池和代码位置创建新网站。

阅读官方.

您可能也对 CORS 感兴趣。从以下位置安装 IIS corshere https://www.iis.net/downloads/microsoft/iis-cors-module.

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

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

将ASP.Net Core 2.1preview2网站发布到本地IIS MSB3030 *.PrecompiledViews.dll 的相关文章

随机推荐