Search code examples
asp.net-mvc-5reactjs.net

ReactJS NET on MVC5 fails to resolve dependency


I have the same problem as mentioned in the following question here:

ReactJS.Net on MVC5 fails to resolve dependency

Everything in this question is exactly the same, and just as descriptive. However, this question must be answered again, because of the following reasons:

I have the latest dll with the applied fix (latest React.NET dlls):

<package id="React.Core" version="1.5.5" targetFramework="net45" />
<package id="react.js" version="0.13.1" targetFramework="net45" />
<package id="React.Web" version="1.5.5" targetFramework="net45" />
<package id="React.Web.Mvc4" version="1.5.5" targetFramework="net45" />
<package id="System.Web.Optimization.React" version="1.5.5" targetFramework="net45" />

The project works on 3 of my machines (local, dev server, QA server). But when I tried to deploy to production, I got stuck the following error message:

[JsRuntimeException: Object doesn't support this property or method]
MsieJavaScriptEngine.ActiveScript.ActiveScriptJsEngineBase.InvokeScript(Action action) +161
JavaScriptEngineSwitcher.Msie.MsieJsEngine.InnerExecute(String code)

...

[TinyIoCResolutionException: Unable to resolve type: React.JavaScriptEngineFactory]

...

[TinyIoCResolutionException: Unable to resolve type: React.ReactEnvironment]

This is running on IIS7.5, and I just upgraded to .net 4.5.

Is there any other missing requirements I should be looking at?


Solution

  • I figured it out:

    Go to IIS, application pool, and go to the pool you're using for your website, then click advantage settings:

    Make sure your Enable 32-Bit Applications is set to TRUE.

    Personally, I'm not sure why this works, but it does. Especially from the standpoint that if I removed the JSX files, the site worked. But I needed my react components :-/

    In powershell 1:

    & "C:\Windows\System32\inetsrv\appcmd.exe" set apppool /apppool.name:DefaultAppPool /enable32BitAppOnWin64:true
    

    where DefaultAppPool is the name of your application pool.