No transpilation on IIS production server -

First off, a lot of this technology is new to me, so I apologize for the noob question. Also, this is my first post to SO (after years of reading), so forgive the formatting.
I have a web application that I am running via MSVS 2017. I am writing my front end with React.js. After installing the appropriate packages via nuget, I have something that works when I run both the debug and release versions on my local dev machine (using iisexpress).
However, after I commit my source changes, and it gets pushed to the test server (IIS), the app runs fine. But, the JSX files that are returned from the test server are not transpiled. I just get the raw JSX file. Whereas, on my local machine, the returned file is transpiled.
I have a ReactConfig.cs file with a single static Configure method, where I have a call to add my JSX file via ReactSiteConfiguration.Configuration.AddScript, but that appears to be unnecessary because I still get a transpiled result even when it is commented out. At the top of my ReactConfig.cs file I have seomthing similar to:
[assembly: webActivatorEx.PreApplicationStartMethod(typeof(MyApp.Api.Controllers.MyController), "AutoMapperStart")]
So, then I am left with the question of how is the transpiling occuring on my dev machine, but not the deployment machine.
In my web.config file, I have tried both:
<add verb="GET" path="*.jsx" type="React.Web.BabelHandlerFactory, React.Web" />
<remove name="Babel" /><add name="Babel" verb="GET" path="*.jsx" type="React.Web.BabelHandlerFactory, React.Web" preCondition="integratedMode" /></handlers>
But neither seems to make a difference on the deployed server.
If anyone has suggestions of what I should look at next, it would be greatly appreciated.
I notice the relevant item that is allowing my dev environment to do the transpilation is the second code section above in my web.config file. However, that I don't see the same lines on the server. Are web.config file typically 'hand edited' per deployment, perhaps?

So, here is what I eventually figured out that worked for me.
First, yes, the web.config file is deployed with as a template. And then hand configured as necessary.
Second, and more importantly, there are two parts to getting the server to render JSX to pure JS.
I needed the following in the web.config file:
<remove name="Babel" />
<add name="Babel" verb="GET" path="*.jsx"
type="React.Web.BabelHandlerFactory, React.Web"
And finally, in the assemblyBinding section:
<assemblyIdentity name="JavaScriptEngineSwitcher.Core" publicKeyToken="c608b2a8cc9e4472" culture="neutral" />
<bindingRedirect oldVersion="" newVersion="" />


ASMX operation 404s, but ASMX service description doesn't, url routing issue?

So I've found myself with a conundrum. We have some old asmx web services in our app that have worked fine for ages.
All of the sudden they stopped working on the build server (CI). I say stopped working, because even though the service description displays when I navigate to the service, invoking any operation doesn't get routed to the service (Web Form Routing). There are 2 strange issues that arose in my attempt to fix this problem.
1.) After shelving all my pending changes, grabbing latest from TFS, and doing a local build (which unless I'm mistaken, will get me what is on the build server since we build/push with each check in). I noticed that I can't duplicate the error locally.
2.) Even though I can't duplicate the error locally, I still suspect routes, however the routes for all our services are added to the table first, and look like this : "{service}.asmx/{*pathInfo}", I guess this was added as a safety precaution as something like MyService.svc shouldn't even make it to the router, as the file actually exists, though I'm not sure if that rule applies for MyService.svc/MyMethod
I'm not really sure how to test routing, i.e. where to set a break point to know if I'm going through the route table for a particular request or not, so any pointers in that area would be appreciated, as well as any other ideas as to why this might be happening.
I've just encountered the same error, after stumbling over this SO entry:
Handlers returns 404 error on IIS7.5 integrated pipeline
and tried the solution of adding the asmx handler to the web.configs webServer section all was well:
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true"/>
<add verb="*" path="*.asmx" name="asmx" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</system.webServer> core 2.2 AspNetCoreModuleName not changed in web.config

I have property group like this in my .csproj file
and yet when publishing to the server with dotnet publish /p:PublishProfile=ITProfile in the server my web.config does look like this:
<?xml version="1.0" encoding="utf-8"?>
<location path="." inheritInChildApplications="false">
<add name="aspNetCore" path="*" verb="*"
modules="AspNetCoreModuleV2" resourceType="Unspecified" />
<aspNetCore processPath="dotnet"
<environmentVariable name="ASPNETCORE_ENVIRONMENT" value="IT" />
The published has hostingModel set to "InProcess", so whats going on? Where does it get the values to the web.config when it's generated?
And im not using the InProcess because it gives me HTTP Error 500.0 - ANCM In-Process Handler Load Failure. Dont know if it's the old IIS or what is going on, installed the newest hosting modules etc, have the AspNetCoreModuleV2 in modules in IIS as expected.
And im not using the InProcess because it gives me HTTP Error 500.0 -
ANCM In-Process Handler Load Failure. Dont know if it's the old IIS or
what is going on, installed the newest hosting modules etc, have the
AspNetCoreModuleV2 in modules in IIS as expected. When you use In
Processes, you need to use a standalone AppDomain.
In your IIS, simply create a new Appdomain, with the No-Managed-Code Option
Put your app in that new appdomain.
That solves this issues.
The documentation for .net-core In-Process hosting on IIS states that it requires a standalone app-domain

Restful WCF IIS 7.5 405 Method Not Allowed Intermittent

I recently added some functionality to our WCF restful api compiled in .NET 4.0 hosted in our own web server using IIS 7.5. When I'm testing in postman it works for awhile, then I start receiving 405 Method not allowed errors. If I wait a period of time (nothing specific), then it will work for a few calls, then start over again.
After some searching, my best guess is we have some sort of handler mapping issue, but I don't know why all of a sudden we would as we haven't changed anything in IIS for quite some time.
I've tried what some others suggested in other questions such as the following:
(snipped of my web.config) and these haven't worked to resolve the issue.
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
<remove name="ServiceModel" />
<remove name="svc-Integrated" />
<add name=".svc" verb="*" path="*.svc" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory,
System.ServiceModel.Activation, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
I should note that we are using .svc-less WCF (unsure if this is the correct terminology, but we don't have .svc files).
The website this application is in, is within a .NET 4.0-Integrated application pool.
When I look at the Handler Mappings within IIS, I see duplicates for "", ".", and "*.svc", but I have no idea what should and what should not be there. Here is what I see for .svc listed in IIS.
one thing I haven't done as I'm nervous to do so is:
fire up your Visual Studio 2010 Command Prompt or browse to "C:\Windows\Microsoft.NET\Framework\ v4.0.30319". And run the following command from the command prompt: aspnet_regiis.exe -iru
I'm open to suggestions here, and I will gladly provide more details, but just not sure what else I can add at this time.
So far what has worked for me was clearing the RoutTable in our "InitializeService.cs" file.
I don't know if something got cached in our IIS 7.5 server, or what the root cause of this is/was, but everything else I tried, nothing worked and after clearing the routes before adding them, I haven't had a 405 error.
Maybe someone else will find this helpful.

Django / Azure : serving static files in production

I want to deploy a Django website hosted in an Azure Web App.
The static files are served perfectly in DEBUG mode (DEBUG=False), but I can't find the right settings to have the server take care of it in production. All my static files are collected in a "static" directory at the app root wwwroot/static/.
Here is the web.config, at the root of the application.
<?xml version="1.0" encoding="utf-8"?>
<add key="WSGI_ALT_VIRTUALENV_HANDLER" value="MyApp.wsgi.application" />
<add key="WSGI_ALT_VIRTUALENV_ACTIVATE_THIS" value="D:\home\site\wwwroot\env\Scripts\python.exe" />
<add key="WSGI_HANDLER" value="ptvs_virtualenv_proxy.get_venv_handler()" />
<add key="PYTHONPATH" value="D:\home\site\wwwroot" />
<add key="DJANGO_SETTINGS_MODULE" value="MyApp.settings" />
<add key="WSGI_LOG" value="D:\home\LogFiles\wfastcgit.log"/>
<add name="PythonHandler" path="handler.fcgi" verb="*" modules="FastCgiModule" scriptProcessor="D:\Python34\python.exe|D:\Python34\Scripts\" resourceType="Unspecified" requireAccess="Script"/>
<rule name="Static Files" stopProcessing="true">
<add input="true" pattern="false" />
<rule name="Configure Python" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<action type="Rewrite" url="handler.fcgi/{R:1}" appendQueryString="true" />
I also added the following web.config in the static directory:
<?xml version="1.0"?>
<!-- this configuration overrides the FastCGI handler to let IIS serve the static files -->
<clear />
path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule"
requireAccess="Read" />
I also defined the static directory as a "virtual directory" in the web app settings, with "\static" refering to "\site\wwwroot\static", and checking the "application" checkbox (i also tried to leave it unchecked but it does not change anything.
However, this is not working.
1) Is it possible to setup an Azure web app to serve the static files in production without using a CDN?
2) If yes, how to do it?
I was able to solve the problem after contacting Azure support. This is actually not a trivial problem, and other may have experienced it. The solution below also significantly improves the performances of the app.
According to Microsoft Azure support team:
the default Python version I was using (3.4) creates some problems and it's better to install a new Python version using the web app extensions.
For Azure Web App in Python, it's better to use HTTP Platform Handler than fastcgi.
I was also experiencing very slow loading page. This was due to a high number of Python packages that were loaded when the application restart. for some reason, the default Python version tends to fail, so the application has to restart even if the "Always ON" settings is ON. It seems that Azure actually loads the Python environment from a different disk than the Python code, and this creates a significant slow down.
Don't use a virtual environment
Here is the procedure I followed to solve the problem(s):
Install Python 3.5 as a web app extension. This can easily be done using the Azure portal for the web application : "Settings > Extensions"
In the Azure portal for the web app, go to "Advanced Tools". Open the Kudu advanced tool, then the CMD console (from the "Debug console" menu at the top of the Kudu page). Navigate to the home directory and find where the new Python has been installed. In my case it was in "D:\home\python353x86"
Now it's time to update the web.config using the new Python version. This path is explained in great details here: Be careful to replace the processPath="D:\home\Python27\python.exe" from the tutorial with your own Python path. Same thing for the deployment script
Add a new web.config file in your static directory, as described in the same tutorial
Install Python packages, by using the debug console and your "requirements.txt" file, running:
D:\home\python353x86\python.exe -m pip install -r requirements.txt
Replace the python path with your actual path. The python packages are now installed along with your Python exe. Using a virtual environment will slow down the loading of your web page in case the application has to restart.
At this point, your web app should work properly
Additional note:
If you are using webjobs, you need to update the way you are running them.
The solution is to create a "run.cmd" file in your webjob directory, containing :
Where is your webjob script. Once again, replace the python path with your actual path.
I've solved this problem by adding this 2 lines to the top of <handlers> section in root web.config file:
<remove name="Python27_via_FastCGI" />
<remove name="Python34_via_FastCGI" />
Everything else is the same as your's web.config and I didn't need separate config file in static/ directory
It's a good idea to move your static content to Azure Blob Storage and use a CDN for a better performance.
1-) You can define your web.config just like the following:
2-) to configure the static file handler, add the following:

Session state can only be used when enableSessionState is set to true either in a configuration

I am working on MVC 2 app with c# by using vs 2010.I am having below mentioned error when I run my app locally under debug mode.
Error message image is as below :
Error message text is as below :
Session state can only be used when enableSessionState is set to true,
either in a configuration file or in the Page directive. Please also
make sure that System.Web.SessionStateModule or a custom session state
module is included in the <configuration>\<system.web>\<httpModules>
section in the application configuration.
What I did for sort out this issue are as below :
Try 1 : web.config file has been changed like below:
<modules runAllManagedModulesForAllRequests="true">
<remove name="Session" />
<add name="Session" type="System.Web.SessionState.SessionStateModule, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Try 2 is as below :
But Unfortunately still I am having same issue which I have mentioned Above.
Do you have any solution for this ?
Did you enable the session state in the section as well?
<pages enableSessionState="true" />
Or did you add this to the page?
<%#Page enableSessionState="true">
And did you verify that the ASP.NET Session State Manager Service service is running? In your screenshot it isn't. It's set to start-up mode Manual which requires you to start it every time you want to make use of it. To start it, highlight the service and click the green play button on the toolbar. To start it automatically, edit the properties and adjust the Start-up type.
Or set the SessionState's mode property to InProc, so that the state service is not required.
<sessionState mode="InProc" />
Check MSDN for all the options available to you with regards to storing data in the ASP.NET session state.
Note: It's better to have your Controller fetch the value from the session and have it add the value to the Model for your page/control (or to the ViewBag), that way the View doesn't depend on the HttpSession and you can choose a different source for this item later with minimal code changes. Or even better, not use the session state at all. It can kill you performance when you're using a lot of async javascript calls.
also if you are running SharePoint and encounter this error, don't forget to run
Enable-SPSessionStateService -DefaultProvision
or you will continue to receive the above error message.
Actually jessehouwing gave the solution for normal scenario.
But in my case I have enabled 2 types of session in my web.config file
It's like below.
First one :
<modules runAllManagedModulesForAllRequests="true">
<remove name="Session" />
<add name="Session" type="System.Web.SessionState.SessionStateModule, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
Second one :
<sessionState mode="Custom" customProvider="DefaultSessionProvider">
<add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="PawLoyalty" applicationName="PawLoyalty"/>
So in my case I have to comment Second one.B'cos that thing for the production.When I commented out second one my problem vanished.
I want to let everyone know that sometimes this error just is a result of some weird memory error. Restart your pc and go back into visual studio and it will be gone!! Bizarre!
Try that before you start playing around with your web config file etc like I did!!!! ;-)
In my case problem went away simply by using HttpContext.Current.Session instead of Session
I realise there is an accepted answer, but this may help people. I found I had a similar problem with a ASP.NET site using NET 3.5 framework when running it in Visual Studio 2012 using IIS Express 8. I'd tried all of the above solutions and none worked - in the end running the solution in the in-built VS 2012 webserver worked. Not sure why, but I suspect it was a link between 3.5 framework and IIS 8.
For SharePoint
Can find the web config file in C:\inetpub\wwwroot\wss\VirtualDirectories\Sitecollection port number
- and Make changes
<pages enableSessionState="true" />
and using SharePoint Management Shell Run below Command
Enable-SPSessionStateService -DefaultProvision
Following answer from below given path worked fine.
I found a solution that worked perfectly! Add the following to web.config:
<!-- UrlRewriter code here -->
<remove name="Session" />
<add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition="" />
Hope this helps someone else!
This error was raised for me because of an unhandled exception thrown in the Public Sub New() (Visual Basic) constructor function of the Web Page in the code behind.
If you implement the constructor function wrap the code in a Try/Catch statement and see if it solves the problem.
I have got this error only when debugging the ASP .Net Application.
I also had Session["mysession"] kind of variables added into my Watch of Visual Studio.
the issue was solved Once, I have removed the Session Variables from watch.
Could be your skype intercepting your requests at 80 port, in Skype options uncheck
Or Your IE has connection checked for Proxy when there is no proxy
Or your fiddler could intercept and act as proxy, uncheck it!
Solves the above problem, It solved mine!
Session State may be broken if you have the following in Web.Config:
If this is the case, you may want to comment out such section, and you won't need any other changes to fix this issue.