ASP MVC Less file gives: Exception has been thrown by the target of an invocation

亡梦爱人 提交于 2019-12-23 20:17:57

问题


I have a simple asp.net mvc 4 site that uses less files. When i run it on my local pc it works fine, but when i publish it to the server I get te following error:

During the output text content of processed asset an unknown error has occurred.
See more details:
Exception has been thrown by the target of an invocation.

stacktrace:

[HttpException (0x80004005): During the output text content of processed asset an unknown error has occurred.
See more details:
Exception has been thrown by the target of an invocation.]
   BundleTransformer.Core.HttpHandlers.AssetHandlerBase.ProcessRequest(HttpContextBase context) +1895
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +913
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165

For rendering the less files i use the BundleTransformer.Less and in the web.config i added in bundletransformer:

<less useNativeMinification="false" ieCompat="true" strictMath="false" strictUnits="false" dumpLineNumbers="None">
      <jsEngine name="V8JsEngine" />
    </less>

回答1:


Try to install the Visual C++ Redistributable Packages for Visual Studio 2013 on the server.

Note: older versions of the JavaScriptEngineSwitcher.V8 (before version 1.3.0) required the Visual C++ Redistributable for Visual Studio 2012.




回答2:


Some versions of JavaScriptEngineSwitcher / BundleTransformer packages may not work well on IIS 8.5 web servers (I don't know exactly what cause an error, it might be some dependencies, e.g. ClearScript dlls)

I have similar issues today after attempt to upgrade to last versions on NuGet and after fights decide to revert back to usage of the following versions (tested and works well on IIS 7 / IIS 8.5):

  <package id="BundleTransformer.Core" version="1.9.25" targetFramework="net45" />
  <package id="BundleTransformer.Less" version="1.9.25" targetFramework="net45" />
  <package id="JavaScriptEngineSwitcher.Core" version="1.2.4" targetFramework="net45" />
  <package id="JavaScriptEngineSwitcher.V8" version="1.2.0" targetFramework="net45" />

You can use NuGet console to install specific version of given packages (see How to install an older version of package via NuGet?)



来源:https://stackoverflow.com/questions/29647337/asp-mvc-less-file-gives-exception-has-been-thrown-by-the-target-of-an-invocatio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!