ASP.Net Core MVC 網站在Windows服務器跑不起來

1.vs遠程發佈到服務器,瀏覽器訪問,報錯502

2.打開錯誤提示提供的網址參考

3.安裝runtime,sdk,Hosting Bundle Installer,其餘操做 .....發現並無什麼用(後續操做發現仍是環境問題...這裏重點記一下,有空再研究一下)

4.打開windos日誌,發現有錯誤提示

Application 'MACHINE/WEBROOT/APPHOST/MYWEB' with physical root 'C:\IIS\MyWeb\' failed to start process with commandline 'dotnet .\Sky.HelloCore.Web.dll', ErrorCode = '0x80004005 : 8000808c.

5.到網站目錄打開cmd窗口,運行「dotnet Sky.HelloCore.Web.dll」,發現報錯...

6.直接百度錯誤信息,有答案是說asp.net 沒有把服務器須要的包所有發佈出來,它認爲是目標系統帶着有,而實際上目標系統中沒有。

7.最後,給項目文件(csjproj文件)加上一行代碼。中文翻譯貌似是發佈帶上AspNetCore目標清單?

<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>

完整的項目文件xmlhtml

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="AngleSharp" Version="0.9.9.2" />
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.8" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.4" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="NewLife.Core">
      <HintPath>..\DLL\NewLife.Core.dll</HintPath>
    </Reference>
    <Reference Include="Sky.Gallery">
      <HintPath>..\DLL\Sky.Gallery.dll</HintPath>
    </Reference>
    <Reference Include="XCode">
      <HintPath>..\DLL\XCode.dll</HintPath>
    </Reference>
  </ItemGroup>

</Project>

8.問題是解決了,可是!!!發佈把全部的包都發布了,整個文件夾40多兆,因此這個方法不太好


待研究,服務器已經安裝上了runtime,就不該該還有報某個包不存在...

#### 待排查是否是GAC沒有這個包....

終結此貼,網站是基於nc2.0,也許我裝的2.1不行,因而從新安裝2.0的兩個包就能夠了
web

相關文章
相關標籤/搜索