Kra*_*zek 9 c# asp.net iis project.json asp.net-core-1.0
我刚刚将一个正在运行的RC2 Web应用程序转换为RTM,我在IIS上发布了一些问题.
我找到的所有示例都基于NetCoreApp1.0应用程序.由于某些要求,我们仅限于"net46".
这是project.json
{
"version": "1.0.0-*",
"dependencies": {
"Domain": "1.0.0-*",
"Microsoft.AspNetCore.Authentication": "1.0.0",
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Authentication.Facebook": "1.0.0",
"Microsoft.AspNetCore.DataProtection.SystemWeb": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Http.Extensions": "1.0.0",
"Microsoft.AspNetCore.Localization": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"PublicLib": "1.0.0-*",
"PublicLib.Imaging": "1.0.0-*",
"PublicLib.Interfaces": "1.0.0-*",
"Storage": "1.0.0-*"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview2-final"
}
},
"frameworks": {
"net46": {
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"publishOptions": {
"include": [
"wwwroot",
"web.config",
"Views",
"appsettings.json",
"database.json",
"PublicWeb.nuspec"
]
},
"packOptions": {
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误
Errors in C:\Development\Path\To\Web\Application\project.json
Package Microsoft.DotNet.ProjectModel 1.0.0-rc3-003121 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package Microsoft.DotNet.ProjectModel 1.0.0-rc3-003121 supports:
- net451 (.NETFramework,Version=v4.5.1)
- netstandard1.6 (.NETStandard,Version=v1.6)
One or more packages are incompatible with .NETCoreApp,Version=v1.0.
Run Code Online (Sandbox Code Playgroud)
如果我更改"工具"部分如下,
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview2-final",
"imports": "net451"
}
},
Run Code Online (Sandbox Code Playgroud)
我设法恢复解决方案,但是当我尝试发布解决方案时dotnet publish .\Path\To\Web\Application\ -o .\tmp\public\
,我得到以下输出
Publishing PublicWeb for .NETFramework,Version=v4.6/win7-x64
Project Domain (.NETFramework,Version=v4.6) was previously compiled. Skipping compilation.
Project PublicLib.Interfaces (.NETFramework,Version=v4.6) was previously compiled. Skipping compilation.
Project PublicLib (.NETFramework,Version=v4.6) was previously compiled. Skipping compilation.
Project PublicLib.Imaging (.NETFramework,Version=v4.6) was previously compiled. Skipping compilation.
Project Storage (.NETFramework,Version=v4.6) was previously compiled. Skipping compilation.
Project PublicWeb (.NETFramework,Version=v4.6) will be compiled because inputs were modified
Compiling PublicWeb for .NETFramework,Version=v4.6
Compilation succeeded.
0 Warning(s)
0 Error(s)
Time elapsed 00:00:01.8045183
Configuring the following project for use with IIS: '.\tmp\public\'
Could not load file or assembly 'Microsoft.DotNet.ProjectModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.DotNet.ProjectModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
File name: 'Microsoft.DotNet.ProjectModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
at Microsoft.AspNetCore.Server.IISIntegration.Tools.PublishIISCommand.Run()
at Microsoft.AspNetCore.Server.IISIntegration.Tools.Program.<>c__DisplayClass0_0.<Main>b__0()
at Microsoft.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
at Microsoft.AspNetCore.Server.IISIntegration.Tools.Program.Main(String[] args)
publish: Published to .\tmp\public\
Published 1/1 projects successfully
Run Code Online (Sandbox Code Playgroud)
事件,如果它说Published 1/1 projects successfully
,.\tmp\public\web.config
包含以下行.
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>
Run Code Online (Sandbox Code Playgroud)
虽然它曾经包含
<aspNetCore processPath=".\PublicWeb.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
Run Code Online (Sandbox Code Playgroud)
第二个是部署的服务器上的IIS的工作配置.
有关如何解决此问题的任何建议?
谢谢
这对我有所帮助.
在CMD中输入dotnet --version,如果它显示您使用版本预览1,那么您需要执行此操作以清理缓存并使用preview2强制执行.
首先确保preview2在你的计算机上,在windows上它应该在C:\ Program Files\dotnet\sdk下如果你在dir中有1.0.0-preview2-003121,那么你很高兴去,否则下载最新的sdk首先,确保安装了最新的.Net核心,并从系统中删除dnx文件夹,因为它不再相关(更改为dotnet).
从dotnet sdk目录中删除preview1 sdk版本.
在你的项目文件夹中编辑你的global.json文件应该是这样的.
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-003121"
}
}
Run Code Online (Sandbox Code Playgroud)
现在重新启动你的电脑,以确保所有的服务和进程正在重新启动,运行dotnet还原,现在它工作,它将首先在缓存上运行一些更新,但不要担心大约一分钟或2取决于您的操作系统规格,然后它将执行还原.
小智 3
我遇到了同样的问题,并且能够通过回滚IISIntegration.Tools
到再次发布1.0.0-preview1-final
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2980 次 |
最近记录: |