将ASP.Net Core 2.1preview2网站发布到本地IIS MSB3030 * .PrecompiledViews.dll [英] Publish ASP.Net Core 2.1preview2 website to local IIS MSB3030 *.PrecompiledViews.dll
问题描述
更新1
通过@Priyesh Kumar反馈,我从网站根文件夹(使用带有* .csproj的网站)使用了以下命令.这行得通.然后,我将"win10-x64"内容文件复制到c:\ www \ sigex.com.
With @Priyesh Kumar feedback I have used the following command from the websites root folder (the one with *.csproj for the website). This worked. I then copied the "win10-x64" content files into c:\www\sigex.com.
dotnet publish -c Release -r win10-x64 --self-contained
我现在遇到了一些不同的问题,但是将解决它们,然后将其发布回解决方案.
I am running into a few different issues now but will fix them and then post back the solution.
原始帖子
我正在尝试将我的网站本地发布到IIS(我在IIS管理器中创建的网站)中.我正在Visual Studio中使用右键单击发布选项.
Hi I am trying to publish my website locally into IIS (a site I have made in IIS manager). I am using the right click publish option in visual studio.
在IIS管理器中,我的设置是
In IIS Manager my settings are;
对于应用程序池,我有以下内容
For the application pool I have the following
当我单击发布"并选择"IIS,FTP等"并单击发布"时.然后,将设置输入为发布方法:文件系统".我将目标位置设置为"C:\ www \ sigex.com".我已在"c:\ windows \ system32 \ drivers \ etc \ hosts"文件中使用"127.0.0.1 sigex.com"在本地使用此域(工作正常).
When I click "Publish" and select "IIS, FTP, etc" and click "Publish". I then enter the settings as "Publish method: File System". I set the target location to "C:\www\sigex.com". I have used "127.0.0.1 sigex.com" in the "c:\windows\system32\drivers\etc\hosts" file to use this domain locally (that works fine).
发布设置如下所示;
设置发布配置后,出现以下警告框;
After the publish configuration is set I get the following alert box;
tmp文件中包含以下内容;
The tmp file has the following content inside it;
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.<---
===================
在"Web发布活动"中,我得到以下信息;
Inside the "Web Publish Activity" I get the following;
有人可以帮助我解决我的问题吗?我在这里找到了这篇文章,说他们遇到了同样的问题.
Can any body help me on where I am going wrong? I found this post here which says they are getting the same issue.
https://github.com/dotnet/core/issues/1039
但是他们说这只会在
<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
在* .csproj中设置.我的* .csproj
is set in the *.csproj. I do not have the above in my *.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目标,但这没什么区别.请帮忙.
I tried selecting x86 as the cpu target but that made no difference. Please help.
推荐答案
尝试使用dotnet cli命令发布
Try publishing using dotnet cli command
-
dotnet publish -c Release -r win10-x64 --self-contained
-c:发布配置,发布|调试
-c: Publish configuration, Release|Debug
-r:目标运行时环境.完整列表此处
-r: Targeted runtime environment. Full list here
-自包含:下载并创建一个自包含的程序包,该程序包可以在没有dotnet sdk的情况下运行.
--self-contained: Downloads and created a self contained package which can be run without dotnet sdk.
- Copy folder in
bin/Release/netcoreapp2.1/win10-x64/publish
, where web.config is present to your deployment location. - Make sure to install Dotnet core hosting bundle for IIS.
- Restart the IIS
- Create a new pool with .NET CLR version as
No Managed Code
- Give read/write permission to
IIS_IUSRS
andIUSR
. - Create new website with above app pool and code location.
阅读官方文档.
您可能也对CORS感兴趣.从此处安装IIS cors.
You might be interested in CORS also. Install IIS cors from here.
注意:所有版本均特定于OP的系统.确保替换版本. 注意:请确保您已更新Visual Studio以支持dotnet core
Note: All version are specific to OP's system. Make sure to replace the versions. Note: Make sure you have updated Visual studio to support dotnet core
这篇关于将ASP.Net Core 2.1preview2网站发布到本地IIS MSB3030 * .PrecompiledViews.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!