C# 在Windows Server 2012 R2上运行Asp.net 5 vNext项目(MVC6)发布生成
我根据互联网上的一些资源配置了一切,但我不知道我错过了什么 当我尝试手动启动它(在我的本地计算机上工作!)时,我在服务器上得到以下结果:C# 在Windows Server 2012 R2上运行Asp.net 5 vNext项目(MVC6)发布生成,c#,asp.net,iis,asp.net-core-mvc,asp.net-core,C#,Asp.net,Iis,Asp.net Core Mvc,Asp.net Core,我根据互联网上的一些资源配置了一切,但我不知道我错过了什么 当我尝试手动启动它(在我的本地计算机上工作!)时,我在服务器上得到以下结果: PS C:\Users\Administrator> cd C:\inetpub\wwwroot\approot\myproject\approot PS C:\inetpub\wwwroot\approot\myproject\approot> .\web Error: Unable to load application or execute
PS C:\Users\Administrator> cd C:\inetpub\wwwroot\approot\myproject\approot
PS C:\inetpub\wwwroot\approot\myproject\approot> .\web
Error: Unable to load application or execute command 'Microsoft.AspNet.Hosting'. Available commands: web, kestrel.
System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
at System.Reflection.Assembly.LoadFile(String path)
at Microsoft.Dnx.Runtime.Loader.LoadContext.LoadFile(String assemblyPath)
at Microsoft.Dnx.Runtime.Loader.PackageAssemblyLoader.Load(AssemblyName assemblyName, IAssemblyLoadContext loadContex
t)
at Microsoft.Dnx.Runtime.Loader.PackageAssemblyLoader.Load(AssemblyName assemblyName)
at Microsoft.Dnx.Host.LoaderContainer.Load(AssemblyName assemblyName)
at Microsoft.Dnx.Host.DefaultLoadContext.LoadAssembly(AssemblyName assemblyName)
at Microsoft.Dnx.Runtime.Loader.AssemblyLoaderCache.GetOrAdd(AssemblyName name, Func`2 factory)
at Microsoft.Dnx.Runtime.Loader.LoadContext.LoadAssemblyImpl(AssemblyName assemblyName)
at Microsoft.Dnx.Runtime.Loader.LoadContext.ResolveAssembly(Object sender, ResolveEventArgs args)
at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)
在Windows Server 2012上完成的操作:
Active Version Runtime Architecture OperatingSystem Alias
------ ------- ------- ------------ --------------- -----
1.0.0-rc1-update1 clr x86 win default
这与我的项目和本地计算机中使用的相同
我还从IIS中查找stdout.log,因为我还尝试使用IIS进行设置。但是没有运气。并且没有创建或找不到日志
记录为project.json
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
"Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
"Swashbuckle.SwaggerGen": "6.0.0-rc1-final",
"Swashbuckle.SwaggerUi": "6.0.0-rc1-final",
"Microsoft.AspNet.Server.WebListener": "1.0.0-rc1-final"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000",
"kestrel": "Microsoft.AspNet.Server.Kestrel",
},
"frameworks": {
"dnx451": {
"dependencies": {
"Microsoft.AspNet.Mvc.ViewFeatures": "6.0.0-rc1-final",
"Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-rc1-final"
}
},
"dnxcore50": { }
},
"exclude": [
"wwwroot",
"node_modules",
"bower_components"
],
"publishExclude": [
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
]
}
如果需要其他信息,请告诉我。还不确定原因,因为我假设发布将包含能够运行的所有内容。但是我找到了一个解决办法 如果转到服务器上powershell中的Approt>SRC>ProjectName文件夹并运行dnu restore。。web.cmd会突然起作用!当它加载丢失的包时