How do I register an IIS FastCGI application in a MSDeploy's web.config file as documented?
I'm trying to build a simple test MS Web Deploy package installable by
the Web Platform Installer via a custom feed. I'm trying to
register a FastCGI application in the packages web.config as the
docs indicate is possible. You can see the web.config file below
or in github:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<fastCgi>
<application fullPath="C:\Python27\python.exe" arguments="-u C:\Python27\Scripts\iiswsgi-script.py" monitorChangesTo="C:\Python27\Scripts\iiswsgi-script.py" maxInstances="1" />
</fastCgi>
...
This doesn't work when installed via the Web Platform Installer and then tested through Web Matrix/IIS Express. However, as soon as I run the appcmd.exe command as below and in the install.cmd batch file:
set IIS_BIN=%ProgramFiles%\IIS Express
"%IIS_BIN%\appcmd.exe" set config -section:system.webServer/fastCgi /+"[fullPath='%SystemDrive%\Python27\python.exe',arguments='-u %SystemDrive%\Python27\Scripts\iiswsgi-script.py',maxInstances='1',monitorChangesTo='%SystemDrive%\Python27\Scripts\iiswsgi-script.py']" /commit:apphost
...the FastCGI app works just fine. IOW, it seems like the <fastCGI><application> elements in web.config don't take effect, but they do in IIS's applicationhost.config even though the docs indicate this is possible in web.confg.
Is there a way to get this to work in the specific app (through web.config or otherwise) without changing the global IIS config?
I'm doing all this under Windows 7 Professional, Web Platform
Installer 4.0, and Web Matrix 2.0 RC whose about dialog says:
Version 2.0 RC
WebMatrix: 7.1.1587.0
IIS Express: 8.0.8298.0
.NET Framework: 4.0.30319.17379 built by: FXBETAREL
Web Deploy: 7.1.1516.0
SQL Server Compact: 4.0.8854.1
Web Platform Installer: 7.1.1586.1
ASP.NET Web Pages: 2.0.20505.0
ASP.NET Web Pages: 1.0.20105.407
The code behind all this is in IISWSGI on GitHub, use this commit to test. To reproduce the
environment I'm using, see the IISWSGI documentation.
Related
I’m converting a web application/web site from log4net to NLog. The code has this line:
Log4net.Config.XmlConfiguration.Configure();
This loads the logging configuration from the Web.Config file during startup.
What is the equivalent call to NLog? Is one even needed?
So there are plenty of resources the explain how to get your .net core app published to Azure WebApp. That's not what I'm asking b/c that is straight-forward. But what I haven't been able to track down in searching is exactly how it works once it's published. In this SO: Is it possible to run ASP.NET 5 site directly on Kestrel in Azure WebApps?, the accepted answer indicates "On Azure Web App, you cannot bypass IIS." If that is true, exactly HOW is a .NET Core 2.0 boilerplate app (in this case created with VS 2017 templates), able to work?
In this //build video: https://www.youtube.com/watch?v=7TERFQ_U9W0, Daniel explains how you can use web.config to setup your .net core app behind IIS. This makes sense, but the boilerplate .net core app that I created with VS 2017 has none of this configuration.
So what I'm confused about is: if my .net core app has no specific configuration to use IIS, and if in Azure WebApp you "cannot bypass IIS", how then, am I able to easily publish my asp.net core app to my Azure WebApp and have it "just work"?
Is something happening during the publish process that I don't know about? The way I published was by downloading the publish profile from my Azure WebApp, and then importing it into my project in VS and hitting "publish."
Oh, well it looks like, indeed, during the publish process something is in fact configuring the IIS part. I went and looked at the PubTmp\Out folder (which in hindsight, I should have done first I guess) and found a web.config file that I didn't create. And what do you know, it has:
<aspNetCore processPath="dotnet" arguments=".\MyApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
So this is for the benefit of any other idiots like me out there who didn't think to check the PubTmp\Out folder for a clue.
I have made a ServiceStack Web App that uses a custom AppHost from a plugin (similar to the example https://github.com/NetCoreWebApps/WebApp/tree/master/src/apps/chat). I can run it on macOS with the dotnet command as per the examples.
Can I host my Service Stack Web App on IIS? What approach should I take? Reverse-proxying Kestrel like this https://learn.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x
or will I need to have different AppHost/Startup code for the two hosting situations?
Or maybe there's a fundamental reason why it will never work?
WebApp is a standard .NET Core 2.0 App so you'll be able to host it as you would any other .NET Core App. Normally reverse proxies don't require anything except the internal url where the request is proxied to, but it looks like IIS wants you to explicitly call .UseIISIntegration() which is an issue that may have prevented the existing WebApp binary as it didn't call .NET Core 2.0 WebHost.CreateDefaultBuilder(args) which among other things would turn on IISIntegration when the .NET Core App is hosted in IIS/Windows which is now being done from this commit.
You can find the updated Web App binaries with this change in the /web folder of the https://github.com/NetCoreWebApps/Chat project.
I followed the Angular2 Quick start example and used live-server to run it. It works fine.
I created then a web site in IIS and set the virtual directory to the directory where I have the index.html file. When I run the website I get the following error. The error happens when the IIS tries to server app.ts.
How can run the Angular2 app in IIS?
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
UPDATE:
Solution: I created a new web.config file and added the following snippet of code to add the MIME type. This will be used by the IIS as the local web app settings.
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".ts" mimeType="application/x-typescript" />
</staticContent>
</system.webServer>
</configuration>
By convention, it is not advised to directly serve TypeScript (.ts) files. This is why IIS doesn't enable this by default. The quickstart tutorial also explicitely mentions this halfway the page, on section What's wrong with this?, where it states the following:
We were up and running in a hurry and we could explore Angular in this manner for quite some time. For a number of reasons this isn't a good approach for building an application:
Transpiling TypeScript in the browser becomes tediously slow when our app grows beyond a few files. We certainly won't do that in production. We should learn to compile locally and push the generated JavaScript to the server. We'll need some tools for that.
So if you take a couple of minutes more and finish the tutorial, it'll work out for you just fine without having to bother with IIS configuration.
That being said, if you truly want it, it is possible. Like mentioned in other comments, you can add a MIME type for .ts files in IIS. In the SO question What's the MIME-Type of TypeScript it is explained as well.
try to register a .ts mime type
Add a MIME Type (IIS 7)
Also, this SO seems like a good explanation
I have added the MVC SiteMapProvider to the ASP.NET MVC4 App through nuget
Added the sitemap menu & sitemap path html helper in the layout.
When running the web application in Visual Studio Development Server i got the sitemap menu and sitemap path breadcrumb got generated successfully for the links i specified in the Mvc.Sitemap.
But when i try to run the same application in IIS Express or through IIS, Nodes are not getting generated. Just the generated without any nodes. No errors were thrown. In IIS i run as .net 4.0 integrated.
Any more configuration need to add or need to add any modules in order to run under IIS apart from the configuration generated from nuget in web.config.
Thanks in advance.
I suspect that you haven't deployed your HTML helper templates. Be sure you copy over the contents of the /Views/Shared/DisplayTemplates/ directory to your server.