No recompile of JSX file when debugging - reactjs.net

ReactJS.NET is not recompiling when debugging.
It compiles once, and then it remains static.
Strangely, when I make an error in my and my app is already built, I can fix the JSX and it will compile without having to rebuild my app but it will only do that once.
Where should I be looking to fix it?
My Web.config has
<system.web>
<httpHandlers>
<add verb="GET" path="*.jsx" type="React.Web.JsxHandlerFactory, React.Web" />
</stem.web
<system.webServer>
<remove name="Babel" />
<add name="Babel" verb="GET" path="*.jsx" type="React.Web.BabelHandlerFactory, React.Web" preCondition="integratedMode" />
</handlers>
</system.webServer>
and I've call the JSX in my view with all three methods
<script src="..."></scripts>
#Scripts.Render("...")
#Url.Content("...")
What should I be doing to fix this?

Related

404 Not Found in IIS

I made an ASP.Net MVC 5 app. While debugging on my VS2013 everything runs well but when I deploy it to IIS I start to get some 404 Not Found errors. Is not in every routes but I keep getting this in some GET/POST. I already tried to add on web.config:
<modules runAllManagedModulesForAllRequests="true">
<add name="ScriptCompressionModule" type="Westwind.Web.ScriptCompressionModule,Westwind.Web" />
</modules>
Didn't worked and I read that it wasn't a good pratice, so I changed to:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="UrlRoutingModule-4.0"/>
<!-- Your other add tags-->
<add name="UrlRoutingModule-4.0" path="*" verb="*" type="System.Web.Routing.UrlRoutingModule" preCondition=""/>
</handlers>
</system.webServer>
It's how it is right now.
Aparently the problem was in some ajax request that I have, the url passed must use the #Url.Action helper, because the path on the IIS Server could be different, or part of it.

Glimpse Not working at all

I installed Glimpse for MVC5 via Install-Package Glimpse.MVC5
I turned on Glimpse on the Glimpse config page: /Glimpse.axd
When try to now hit my site, nothing happens. If I turn off Glimpse the site works as expected.
There are no error message or anything http related in Chrome network tools, only a request of: data:text/html,chromewebdata with a response of "Failed to load response data"
This is what Glimpse put in my web.config when I installed it. Not sure how to troubleshoot this.
<httpModules>
<add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" />
</httpModules>
<httpHandlers>
<add path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet" />
</httpHandlers>
<modules>
<add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" preCondition="integratedMode" />
<handlers>
<add name="Glimpse" path="glimpse.axd" verb="GET" type="Glimpse.AspNet.HttpHandler, Glimpse.AspNet" preCondition="integratedMode" />
After adding the Glimpse.AspNet NuGet package, I found that the ASP.NET Development Server was crashing on every request because Glimpse was throwing a NotSupportedException (I only found this after attaching a debuger to the dev server process). The exception's message said:
Some environments conflict with current Glimpse async support. Please set Glimpse:DisableAsyncSupport = true in Web.config, or see https://github.com/Glimpse/Glimpse/issues/632 for more details.
After reading through the GitHub issue, I added this to the appSettings section of my web.config file to get everything working:
<appSettings>
<add key="Glimpse:DisableAsyncSupport" value="true" />
<appSettings>
See: Glimpse Issue: Allow users to disable use of Logical Call Context #632
Just needed to set dynamicCompressionBeforeCache to false and it works:
<urlCompression doStaticCompression="true" doDynamicCompression="true" dynamicCompressionBeforeCache="false" />
Another alternative, instead of simply turning off compression, is to use the #Html.GlimpseClient() Razor Helper right before the </body> tag in your HTML.
The troubleshooting section of the Glimpse documentation covers how to do this.

asp mvc IIS7 less/sass empty file

I'm trying to use less in my new project. I've installed dotLess and System.Web.Optimization.Less packeges (as described in Yet Another "Add LESS to your ASP.NET MVC Project" Post) and locally everything works fine. But when I publish project IIS7 server responds with empty css file /Content/Main/site?v=
Here is my web.config
...
<configSections>
<section name="dotless" type="dotless.Core.configuration.DotlessConfigurationSectionHandler, dotless.Core" />
</configSections>
<system.web>
<httpHandlers>
<add path="*.less" verb="GET" type="dotless.Core.LessCssHttpHandler, dotless.Core" />
</httpHandlers>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="dotless" path="*.LESS" verb="*" type="dotless.Core.LessCssHttpHandler,dotless.Core" resourceType="File" preCondition=""/>
</handlers>
</system.webServer>
<dotless minifyCss="false" cache="true" web="false" />
And my BundleConfig.cs
bundles.Add(new LessBundle("~/Content/Main/site").Include("~/Content/Main/Site.less"));
When I append css extension to my Site.less file (Site.less.css) server responds with content (/Content/Main/site?v=K-FFpFNtIXPUlQamnX3qHX_A5r7TM2xbAgcuEmpm3O41) but it still pure less with all its variables and etc.
The same with Bundle Transformer: Sass and SCSS
What have I missed?
As you are getting
/Content/Main/site?v=K-FFpFNtIXPUlQamnX3qHX_A5r7TM2xbAgcuEmpm3O41
then this means that the bundling is working correctly. Therefore there is probably something in Site.less that is causing the problem. One thing to watch out for is relative urls. For example if you have an image in your css
.bacon {
background-image: url(bacon.png);
}
The bundle will look for this with ~/Content/Main taken from the name of the bundle. (/site is fine and can be anything, it's just the name of the bundle)
The first thing to try is take out any imports, images etc and see if it bundles correctly. You can do this on your local dev build by enabling optimizations in the your bundle config.
BundleTable.EnableOptimizations = true
Another way to solve this is to remove dependency on System.Web.Optimization.Less and dotLess and use free Visual Studio Extension https://github.com/madskristensen/WebCompiler for precompilation of less to css (with and without minification).

Can I deploy a javascript file within MVC areas?

I have my js files inside areas and I cannot access them. When I move them outside the MVC areas then I can access.
I have tried the following:
Different naming of js files - doesn't solve problem
Check to see if they exist on the server - they do
Access file directly from within IIS manager on server - they won't open and return not found
Access same files directly from within IIS manager on server but when files are in script directory - They open in browser
Used the route checker - When I try to access the file it does not open route debug and instead just says "404"
This works:
<script src="#Url.Content("~/Scripts/jquery/_Roles.js")" type="text/javascript"></script>
This does not work:
<script src="#Url.Content("~/Areas/Administration/Scripts/Roles/_Roles.js")" type="text/javascript"></script>
Could there be something different about files under the Areas folder that blocks scripts?
Why put your scripts in the Areas section? I have an mvc site with an area as well, but I still keep my scripts in the Scripts folder.
My suggestion is to rethink the reason you're organizing your content that way and consider moving all external .js files to the Scripts folder.
Found an answer in another Stack Overflow question and tweaked it for areas.
Modify /Areas/AreaName/Views/web.config file to enable the webserver to serve JS and CSS files:
<system.web>
<httpHandlers>
<add path="*.js" verb="GET,HEAD" type="System.Web.StaticFileHandler" />
<add path="*.css" verb="GET,HEAD" type="System.Web.StaticFileHandler" />
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
</httpHandlers>
<!-- other content here -->
</system.web>
<system.webServer>
<handlers>
<remove name="BlockViewHandler"/>
<add name="JavaScript" path="*.js" verb="GET,HEAD" type="System.Web.StaticFileHandler" />
<add name="CSS" path="*.css" verb="GET,HEAD" type="System.Web.StaticFileHandler" />
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
<!-- other content here -->
</system.webServer>
This will allow serving of .js and .css files, and will forbid serving of anything else.
Have you try
ResolveUrl(
instead of
Url.Content(
?
Stefano
<script type="text/javascript" src='<%: ResolveUrl("~/Scripts/jquery/_Roles.js") %>'>
</script>

castle monorails httpHandlers

I have a question and I hope you can help me solve it...
I have a castle monorails application. In web.config file in httphandlers I have *.aspx maped to monorails (my hosting does not suport other extensions...)
<add verb="*" path="*.aspx" type="Castle.MonoRail.Framework.MonoRailHttpHandlerFactory,Castle.MonoRail.Framework"/>
The problem is that I have some Webforms pages that I want to work with aspx... So I am adding something like this to the web.config file...
<add verb="*" path="connector.aspx*" type="System.Web.UI.PageHandlerFactory"/>
<add verb="*" path="ChatPage.aspx*" type="System.Web.UI.PageHandlerFactory"/>
<add verb="*" path="Logon.aspx*" type="System.Web.UI.PageHandlerFactory"/>
Still it does not work.. What am I doing wrong?
Why the asterisk on the end? You should have your monorail-section last, and the specific ones first. You don't need to worry about the query string.
However, maybe you need to take into account to whether they are in a sub-directory when you're being this specific.
like, path="/folder/page.aspx"
I have finally fixed my problem creating a virtual directory where I have cleared the httphandlers
<httpHandlers><clear/>
<add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory"/>
<add verb="*" path="*" type="System.Web.HttpMethodNotAllowedHandler"/>
</httpHandlers>
<httpModules>
<clear/>
</httpModules>
and now it works ok...

Resources