简体   繁体   English

使用Jenkins和MSDeploy发布ASP.net Web项目

[英]Publishing ASP.net web project with Jenkins & MSDeploy

I have a Jenkins box running Server 2012r2. 我有一个运行Server 2012r2的Jenkins机顶盒。 I have .Net 3.5, 4, 4.5 installed on it. 我已经安装了.Net 3.5、4、4.5。 Publishing .net Projects using 4 seems to work perfectly. 使用4发布.net项目似乎可以正常工作。 Where things go wrong is with publishing a .net 4.5 web project. 出现问题的地方是发布.net 4.5 Web项目。

I have three build steps: 1) Builds the SLN project 2) use msbuild to package the resulting compiling from step 1 3) use webdeploy to publish to a separate server. 我有三个构建步骤:1)生成SLN项目2)使用msbuild打包从步骤1生成的编译结果3)使用webdeploy发布到单独的服务器。

The files make their way over to the new server but I then get the following error when navigating to the site: 这些文件进入新服务器,但导航到该站点时出现以下错误:

  Method not found: '!!0[] System.Array.Empty()'.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.MissingMethodException: Method not found: '!!0[] System.Array.Empty()'.

    Source Error: 

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace: 


    [MissingMethodException: Method not found: '!!0[] System.Array.Empty()'.]
       TestDeploySite.BundleConfig.RegisterBundles(BundleCollection bundles) +0
       TestDeploySite.MvcApplication.Application_Start() +96

    [HttpException (0x80004005): Method not found: '!!0[] System.Array.Empty()'.]
       System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +9918157
       System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118
       System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
       System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
       System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

    [HttpException (0x80004005): Method not found: '!!0[] System.Array.Empty()'.]
       System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9932052
       System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
       System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

I have narrowed the issue down to a file in the package/bin directory called 'TestDeploySite.dll'. 我已将问题缩小到package / bin目录中名为“ TestDeploySite.dll”的文件。 When I publish this through VS 2015, it publishes fine. 当我通过VS 2015发布时,它发布得很好。 No errors appear in Jenkins with the build and no warnings exist. Jenkins的构建中没有错误出现,也没有警告。 It feels like a .net version mismatch kind of issue. 感觉就像.net版本不匹配一样。

MSBuild for 4.5 is configured with the following path: C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\MSBuild MSBuild for 4.5使用以下路径配置:C:\\ Program Files(x86)\\ MSBuild \\ 14.0 \\ Bin \\ MSBuild

I have webdeploy installed and it seems to function fine. 我已经安装了webdeploy,它似乎运行正常。 Once I get .net 4.5 projects deploying, I will have to refocus to publish .net Core 1 projects, so that should be... interesting. 一旦部署了.net 4.5项目,我将不得不重新集中精力以发布.net Core 1项目,因此这应该很有趣。

Does anyone have some insight in to addressing this issue? 有人对解决此问题有见识吗?

I ended up checking my msbuild.config for msbuild v14.0 and it showed supported frameworks being 4.0 AND 4.5.1... I went in to VS and changed my target to 4.5.1 and checked in changes to SVN. 我最后检查了msbuild v14.0的msbuild.config,它显示了支持的框架为4.0 AND 4.5.1 ...我进入VS,将目标更改为4.5.1,并检查了对SVN的更改。 Executed job in Jenkins and the site is now publishing fine. 在詹金斯(Jenkins)执行的工作,该站点现在可以正常发布。 A bit odd, though, that it can do 4.5.1 and not 4.5.0... 但是,它可以执行4.5.1而不是4.5.0 ...有点奇怪。

Either way, problem solved. 无论哪种方式,问题都可以解决。

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

相关问题 在服务器上发布 ASP.net 项目 - 失败 - publishing ASP.net project on server -fail 将ASP.NET MVC应用程序发布到Web主机 - 在VS项目结构而不是应用程序中部署文件 - Publishing ASP.NET MVC application to a web host - deploys files in the VS project structure instead of the application ASP.Net mvc,发布Web项目时出错,设置为release - ASP.Net mvc , getting error on publishing a web project , set as release 在 Asp.net 内核中发布项目后未找到 Controller - Controller not found after publishing project in Asp.net Core 发布时从另一个ASP.NET Core 2项目引用ASP.NET Core 2项目失败 - Referencing ASP.NET Core 2 project from another ASP.NET Core 2 project fails when publishing 发布我的asp.net Web应用程序时捕获到异常 - Exception catched when publishing my asp.net web application 将Asp.Net Mvc,Web Api应用程序发布到Windows Azure - Publishing an Asp.Net Mvc,Web Api Application to Windows Azure 将ASP.NET MVC Core应用程序的[部分]发布到Web主机 - Publishing [part] of ASP.NET MVC Core application to web host 在IIS Web服务器中发布时的ASP.NET SqlException - ASP.NET SqlException when publishing in IIS Web Server asp.net Web应用程序,发布后找不到嵌入式资源 - asp.net web app, embedded resource not found after publishing
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM