简体   繁体   English

在Windows Server 2012 R2上运行Asp.net 5 vNext项目(MVC6)发布生成

[英]Run Asp.net 5 vNext project (MVC6) publish build on Windows Server 2012 R2

I configurated everything according to some resources on the internet, but i don't know what i miss.. 我根据互联网上的一些资源配置了所有内容,但我不知道自己想念的是什么。

When i try to start it manually (Which works on my local computer!) i get the following result on the server: 当我尝试手动启动它时(在我的本地计算机上可以运行!),我在服务器上得到以下结果:

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)

Things done on Windows Server 2012: 在Windows Server 2012上完成的操作:

  1. Installed DNVM/DNX 已安装的DNVM / DNX
  2. Enabled features IIS & Application server (Selected Web server (IIS) Support for the application server as well) 启用的功能IIS和应用程序服务器(选定的Web服务器(IIS)也支持应用程序服务器)
  3. .Net 4.5.2 is installed. 已安装.Net 4.5.2。

DNVM list outputs: DNVM列表输出:

Active Version           Runtime Architecture OperatingSystem Alias
------ -------           ------- ------------ --------------- -----
       1.0.0-rc1-update1 clr     x86          win             default

Which is the same as used in my project and local computer. 这与我的项目和本地计算机中使用的相同。

I also looked for the stdout.log from IIS as i also tried setting it up with iis. 我也从IIS寻找stdout.log,因为我也尝试使用iis进行设置。 but no luck. 但没有运气。 And no log is created or can be found. 并且没有日志创建或找不到。

For the record the project.json 记录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"
  ]
}

If additional information is required please let me know. 如果需要其他信息,请告诉我。

Not sure why yet, as i assume that a publish will contain everything to be able to run. 不知道为什么,我假设发布将包含所有能够运行的内容。 But.. i found an resolution. 但是..我找到了解决方案。

If you go to the Approot > SRC > ProjectName folder in powershell on the server and run dnu restore.. the web.cmd will suddenly work! 如果转到服务器上Powershell中的Approot> SRC> ProjectName文件夹并运行dnu restore,则web.cmd会突然起作用! As it loads the missing packages! 当它加载丢失的包时!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我在Windows Server 2012 R2的VS2012中运行asp.net 4.5 mvc 4站点时显示“此页面无法显示” - asp.net 4.5 mvc 4 site shows “This page can’t be displayed” when I run it in VS2012 on Windows Server 2012 R2 我可以在没有MVC6的情况下将WebApi添加到ASP.NET 5(vnext)项目中吗? - Can I add WebApi to an ASP.NET 5 (vnext) project without MVC6? 将Visual Studio 2012 ASP.NET(4.5框架)项目部署到Server 2012 R2 Standard - Deploy Visual Studio 2012 ASP.NET (4.5 Framework) project to Server 2012 R2 Standard Word Documents.Open在ASP.NET Windows Server 2012 R2中返回null - Word Documents.Open returns null in ASP.NET windows server 2012 R2 将 .net core 项目部署到 Windows Server 2012 r2 - Deploy .net core project to Windows Server 2012 r2 ASP.NET 5 MVC6错误:项目不是Web项目 - ASP.NET 5 MVC6 Error: project is not a web project 在x86模式下构建MVC6 / ASP.Net 5项目 - Build MVC6 / ASP.Net 5 project in x86 mode 从web.config到Asp.net 5.0 Core vnext MVC6的企业库数据库连接 - Enterprise Library Database connection from web.config into Asp.net 5.0 Core vnext MVC6 如何根据ASP.NET VNEXT MVC6中给出的路径进行虚拟路由/重定向? - How can I do a virtual route/redirect based on the path given in ASP.NET VNEXT MVC6? asp.net中Windows Server 2008 R2上的PDF缩略图 - PDF Thumbnails on windows server 2008 R2 in asp.net
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM