Subscribe: Rick Strahl's Web Log
http://www.west-wind.com/weblog/rss.aspx
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
application pool  application  bit  core  iis  kestrel  markdown monster  markdown  monster  net core  net  process  web 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Rick Strahl's Web Log

Rick Strahl's Web Log



Life, Surf, Code and everything in between



 



More on ASP.NET Core Running under IIS

Fri, 17 Mar 2017 05:40:45 GMT

My last post on ASP.NET Core and IIS generated a lot of interest and also a lot of questions and discussion in the commment section to warrant a follow up post. In this post I address a few common themes that keep coming up in regards to IIS hosting of ASP.NET Core applications. A quick Review of IIS Hosting for ASP.NET Core When using ASP.NET Core on Windows, your most likely setup involves using IIS as a front end to the ASP.NET Core Kestrel Web Server that actually runs your ASP.NET Core application. IIS acts as a front end proxy to the backend Kestrel Console application that hosts the .NET based Kestrel Web server. In this scenario, IIS uses a very low level and early pipeline AspNetCoreModule that intercepts all requests pointed at it (via a module mapping) and then forwards those requests to Kestrel on a different port. Requests come in on standard HTTP ports (80 and 443 for SSL) and IIS proxies the incoming requests to a different port that Kestrel is listening on. By default the module configuration forwards all requests to Kestrel, but you have some very limited control over what gets routed to the module. Why do you need a proxy? Kestrel is a raw Web server that knows how to serve HTTP requests, but it doesn't include support for hosting multiple services on the same port, host headers, easy SSL configuration and any number of other useful features that a full featured Web service like IIS provides. Some of these features may come in the future, but today it's very likely that if you have a public facing Web site or service you'll need some sort of front end Web server that proxies relevant requests to Kestrel. Process Identity One important aspect of running a Web application is process identity. When using IIS the process identity is determined through IIS Application Pools, and that IIS identity is carried forth to the ASP.NET Core Kestrel process. This means if you set the Launch Identity for the IIS Application Pool to a specific account, the ASP.NET Core Module launches the Kestrel process under that same account. It's easy to see if you open Task manager and look at the w3wp.exe process (there may be more than one for each application pool so you have find the right one which you can do by looking at the command line aruments in Process Explorer or Task Manager) and the dotnet.exe process. In this example, I'm using my local desktop machine and I've set the Application Pool identity to Network Service: You can see that both w3wp.exe and dotnet.exe - which runs the Kestrel Web server process - are using the same NETWORK SERVICE account. Keep in mind that you may have multiple application pools, and multiple instances of .NET Core Application's running at the same time in which case each application pool and kestrel process will launch in their associated security context. In the example above, I only have the IIS AppPool active to demonstrate the Identity is indeed transferred to the the Kestrel process. Both of these will run using the same User Identity so both should have the same set of permissions to access local disk resources, network resources and access to connections over the network. If you need to use Windows credentials for things like SQL Server Authentication, then you can choose to use an account that has the necessary access right on the domain or local machine to make that happen. IIS Application Pool Lifetime One important feature you gain by using IIS as a front end to your ASP.NET Core application is that you get to take advantage of IIS's lifetime management features. The IIS Admin service can ensure that your application gets launched when the AppPool starts, and gets shut down when the AppPool shuts down. If Kestrel crashes the Admin features provided by the ASP.NET Core Module also trigger for dotnet.exe to get relaunched. If you make changes to the Application Pool and end up changing the Identity or any other feature, the Application Pool is shut down and Kestrel with it, and then restarted with the new Application Pool and settings. IIS handles draining of the request pipeli[...]



Debugging the Web Browser Control with FireBug

Wed, 08 Mar 2017 10:09:31 GMT

If you need to debug JavaScript code or layout issues in a Web Browser control inside of a Windows desktop application, you've probably found that the experience sucks. Although Internet Explorer on which the control is based suppports rich developer tools, those are not available in the Web Browser control. Enter an oldie but goodie: FireBug which is an embeddable Console implementation that provides a lot of the features that you find in modern browser developer tools and with a couple of lines of html you can add this debugger into your application.(image)



Getting JavaScript Properties for Object Maps by Index or Name

Sat, 04 Mar 2017 21:59:11 GMT

Getting value out of maps that are treated like collections is always something I have to remind myself how to do properly. In this post I look at JavaScript object iteration and picking out values from a JavaScript object by property name or index.(image)



Video Rendering Issues for WPF Windows

Tue, 14 Feb 2017 00:57:23 GMT

Recently I ran into a few reports of black screen of death rendering of Markdown Monster when starting up from a very few users of the application. They reported the screen just shows black, while actually being responsive to moving and showing menus etc. Also moving to another screen often fixes the problem. It turns out this is a hardware related issue with WPF with certain video hardware/monitor combinations. In this post I describe the problem and the workaround to get the application to render properly even on compromised hardware.(image)



Empty SoapActions in ASMX Web Services

Sun, 12 Feb 2017 19:12:01 GMT

Recently I had to deal with an ASMX Web Service that was receiving empty SoapActions from the client. ASMX doesn't like that, but luckily there's an easy work to strip out the errant Soap header.(image)



Creating a portable and embedded Chocolatey Package

Sun, 29 Jan 2017 21:05:40 GMT

Chocolatey is an awesome tool to install software. As a publisher you have a lot of choices of how to create packages and in this post I describe the two packages that I use with Markdown Monster, which is a full downloaded installer package and a fully self contained embedded portable package. Here I cover the basics of Chocolatey package creation and some of the steps required to create a portable package from a full installation and some of the challenges you might run into along the way.(image)



Adding Files to Visual Studio Projects

Wed, 25 Jan 2017 19:35:31 GMT

Visual Studio has a boat load of ways to add new files to a project and various extensions and tools provide even more ways to do the same. Even so the experience to add new files to a project in Visual Studio is one of the most tedious tasks. Here's what bugs me and how I try to work around the verbosity of it all.(image)



New CODE Magazine Article: Getting down to Business with ASP.NET Core

Thu, 12 Jan 2017 20:19:27 GMT

The latest issue of CODE magazine features my `Getting down to Business with ASP.NET` Core article as the cover article. The article focuses on building an ASP.NET Core backend for an Angular 2 front application, covering all aspects of separating business and Web app logic, dealing with EF Core data access in related tables, CORS to be able to run across domains and simple authentication in a client centric REST service application. Check it out.(image)



Faking out the .NET Runtime Version

Tue, 10 Jan 2017 07:04:01 GMT

I've been struggling with DPI Scaling issues in WPF in Markdown Monster and .NET 4.6.2 has a few fixes that address the problems I've been working on. However, requiring 4.6.2 is a problem due to lowish adoption rates and skittishness about installing new versions of .NET. In this post I show a little hack that allows me to compile my app to .NET 4.6.2 but don't require user to have that version installed so those that have it can take advantage of the updates.(image)



Back to Basics: String Interpolation in C#

Tue, 27 Dec 2016 08:12:59 GMT

String Interpolation provides string templating for string literals in C#. Rather than using string.Format you can use string interpolation to produce much more readable code that embeds expression values directly into string literals rather than escaping numeric arguments as you do with string.Format(). In this post I look at how string interpolation works, what the compiler does under the covers and some common use cases where it makes life easier.(image)



Downgrading a .NET Applications from 64 bit to 32 bit for the WebBrowser Control

Fri, 23 Dec 2016 09:14:52 GMT

Recently while working on Markdown Monster I ran into some odd crashes and behaviors when interacting with the Web Browser control in this WPF application. It turns out that some of these inconsistent behaviors are apparently caused by running hte application in 64 bit mode. Switching to 32 bit mode has made the application and Web Browser interaction much more responsive and has stopped the nagging unexplainable crashes. In this post I look at 32 and 64 bit applications in .NET and outline some of the issues I ran into and how I fixed the problem by switching to building a 32 bit app.(image)



Visual Studio Debugging and 64 Bit .NET Applications

Mon, 19 Dec 2016 08:26:59 GMT

Recently while debugging a 64 bit application I found out the hard way that Visual Studio by default will use 32 bit debugging even when running what would otherwise be a 64 bit .NET application. There are a number of options that determine the bitness of your application, but the debugger often behaves differently than your standalone application. In this post I describe, why this might be a problem in some situations and how you can get the debugger to run in 64 bit.(image)



WPF Rendering DUCE.Channel Crashes due to Image Loading

Thu, 15 Dec 2016 09:43:47 GMT

I ran into a nasty WPF rendering bug that affected only a few select machines. Rendering problems in WPF can be terribly difificult to debug because there often is no additional information on what failed and the exceptions that occur are not trappable but fall back to application wide error handling. In this post I describe a specific failure caused by a 'bad' image WPF can't deal with and how I tracked it down and fixed it.(image)



Loading .NET Assemblies out of Seperate Folders

Mon, 12 Dec 2016 09:49:25 GMT

In the process of updating the Addin manager in Markdown Monster I ran into a few snags with loading .NET assemblies out of separate folders. Assembly loading out of non base folders in .NET can be problematic and sure enough I ran into a few issues that took a while to find a work around for. In this post I describe some of the issues of folder based assembly loading and a brute force solution to deal with assembly resolution.(image)



.NET Standard 2.0 - Making Sense of .NET Again

Wed, 23 Nov 2016 09:29:40 GMT

It's taken awhile but it seems Microsoft is finally nailing the message for .NET going forward and .NET Standard with its common API specification is a huge part in making sure that the same base library of .NET is available on all .NET platforms. In this post I look at what .NET Standard is, how it works and what some of the surrounding issues and impacts are for the .NET Eco system.(image)



Introducing Markdown Monster - a new Markdown Editor

Fri, 04 Nov 2016 08:14:57 GMT

I'm happy to announce Version 1.0 of Markdown Monster a Markdown Editor and Weblog Publishing tool for Windows. In this post I give a quick tour of Markdown Monster and provide links to all you need to know to check out this great new Markdown editor.(image)



Windows Update Hell

Thu, 03 Nov 2016 19:26:45 GMT

I've been fighting Windows Update Hell for the last month with failed updates wreaking havoc on my machine. Updates fail to install completely and roll back and then continue to retry each day. Attempts to turn off the particular update now fails as well, so I'm stuck in this groundhog day like loop of pain. This is a cry for help, in hopes somebody has additional ideas on what to try.(image)



C# NumberFormat Sections

Thu, 03 Nov 2016 17:27:56 GMT

In all the years I've been using C#, I've completely missed that the NumberFormat features using .ToString() or string expressions support sections for positive, negative and zero values. In this post I describe the feature and how it works.(image)



Excluding the node_modules Folder in Visual Studio WebSite Projects

Sun, 30 Oct 2016 19:42:40 GMT

If you're working on a client side project that includes an NPM folder with a large number of dependencies and you're using a WebSite Project in Visual Studio, you've probably found that this is a terrible combination out of the box. In this post I describe why this is a problem and how you can work around it with a simple hack.(image)



Automating Installation Builds and Chocolatey Packaging

Wed, 26 Oct 2016 06:08:01 GMT

Having a quick and easy way to build a final deployable applicationsin a few minutes has been a huge motivation for me. I can update code and release a new build as soon as a feature is added or a bug is fixed, and my release cycle is much more frequent than it was before. I used to be much more conservative with releases - if something was broken it'd have to wait. But with an easy release mechanism all of that has changed and I can push new releases out much more frequently and I really like the fact that it works this way. In this post I describe my deployment processing for Markdown Monster for creating an installer, publishing it on my Web site and creating and publishing a Chocolatey package.(image)



Error Handling and ExceptionFilter Dependency Injection for ASP.NET Core APIs

Mon, 17 Oct 2016 06:14:05 GMT

Exception handling in API applications is important as errors - both handled and unhandled - need to be passed to clients in some way to let them display error information. ASP.NET's default error handling doesn't provide for object error results by default, but you can use an ExceptionFilter to intercept exceptions and format them yourself. In this post I look at how to create an API exception filter to create error object responses, and hook up custom logging of those errors to disk.(image)



Dealing with Anti-Virus False Positives

Wed, 05 Oct 2016 20:22:27 GMT

I've been struggling with false positive Anti-Virus warnings for Markdown Monster. In this post I describe what problems I was running into and how eventually managed to get a clean distribution of Markdown Monster out the door.(image)



External Network Access to Kestrel and IIS Express in ASP.NET Core

Thu, 29 Sep 2016 01:19:50 GMT

Recently I needed to connect to my Windows based ASP.NET Core API from my Mac and in order for that to work some configuration settings are necesary so that the ASP.NET applications can serve HTTP content to the external network connection that this entails. In this post I show what you have to do to enable remote connections both using the Kestrel and IIS Express Web servers.(image)



ASP.NET Core and CORS Gotchas

Mon, 26 Sep 2016 21:34:08 GMT

CORS is a requirement for cross domain XHR calls, and when you use Angular 2.0 default dev server and talk to an ASP.NET Core application you'll need to use CORS to get XHR to talk across the domain boundaries. Here's how to set up CORS and how to test it.(image)