当我发布我的ASP.NET Core(v1.0.0)MVC 6应用程序时,查看任何页面时都无法成功运行(即,服务器/主机启动良好,但在进行GET请求时会抛出错误)。在命令提示符下启动应用程序时,我可以看到它抱怨缺少一个DLL文件。我将缺失的DLL文件添加到发布目录(应用程序由IIS / Krestel托管的位置),然后它抱怨另一个DLL文件,然后是另一个,依此类推。最终,在一切成功运行之前,它需要以下DLL文件:
我不确定为什么发布Web应用程序需要NuGet DLL,也不知道为什么会发生这种情况。显然,Visual Studio应该为我们处理这类事情。目前,当我发布时,我不清除所有文件(因此我手动复制的DLL保留在那里),但我想知道为什么如果需要这些DLL,它们为什么不作为部署过程的一部分包含在内?
以下是我的project.json,如果有帮助的话:
Microsoft.DotNet.Cli.Utils.dll
Microsoft.DotNet.ProjectModel.dll
Microsoft.Extensions.CommandLineUtils.dll
NuGet.Common.dll
NuGet.Configuration.dll
NuGet.DependencyResolver.Core.dll
NuGet.Frameworks.dll
NuGet.LibraryModel.dll
NuGet.Packaging.Core.dll
NuGet.Packaging.Core.Types.dll
NuGet.Packaging.dll
NuGet.ProjectModel.dll
NuGet.Protocol.Core.Types.dll
NuGet.Protocol.Core.v3.dll
NuGet.Repositories.dll
NuGet.RuntimeModel.dll
NuGet.Versioning.dll
我不确定为什么发布Web应用程序需要NuGet DLL,也不知道为什么会发生这种情况。显然,Visual Studio应该为我们处理这类事情。目前,当我发布时,我不清除所有文件(因此我手动复制的DLL保留在那里),但我想知道为什么如果需要这些DLL,它们为什么不作为部署过程的一部分包含在内?
以下是我的project.json,如果有帮助的话:
{
"dependencies": {
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.AspNetCore.Session": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Serilog.Extensions.Logging": "1.2.0",
"Serilog.Sinks.File": "2.2.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"System.Data.Common": "4.1.0",
"System.Data.SqlClient": "4.1.0",
"System.DirectoryServices.Linq": "1.2.2.1",
"Microsoft.Extensions.Logging.Filter": "1.0.0",
"BundlerMinifier.Core": "2.2.281"
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"net462": {}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"configurations": {
"DEV": {
"compilationOptions": { "define": [ "DEV" ] },
"buildOptions": { "define": [ "DEV" ] }
},
"PROD_SRV": {
"compilationOptions": { "define": [ "TEST_SRV" ] },
"buildOptions": { "define": [ "TEST_SRV" ] }
},
"PROD_SRV_DEV": {
"compilationOptions": { "define": [ "TEST_SRV_DEV" ] },
"buildOptions": { "define": [ "TEST_SRV_DEV" ] }
},
"TEST": {
"compilationOptions": { "define": [ "TEST" ] },
"buildOptions": { "define": [ "TEST" ] }
},
"TEST_SRV": {
"compilationOptions": { "define": [ "TEST_SRV" ] },
"buildOptions": { "define": [ "TEST_SRV" ] }
},
"TEST_SRV_DEV": {
"compilationOptions": { "define": [ "TEST_SRV_DEV" ] },
"buildOptions": { "define": [ "TEST_SRV_DEV" ] }
}
}
}
有什么想法吗?
谢谢大家!