IIS / Windows 10: “…your profile cannot be loaded”

Firstly accepting that you would not normally be running IIS on Windows 10 other than for dev work… today I was unable to get past errors where I could not browse  even to the iisstart.htm page:


That manifested itself as Event Ids 1500 and 1511 in the Event logs:

Windows cannot log you on because your profile cannot be loaded. Check that you are connected to the network, and that your network is functioning correctly.

DETAIL – Access is denied.
Windows cannot find the local profile and is logging you on with a temporary profile. Changes you make to this profile will be lost when you log off.

Googling that turned up some suggestions, but nothing that worked for me… if I did not want to mess with regedit. Here and here.


My final attempt was to browse through the app pool defaults and in desperation switch off the “Load User Profile” setting.

And that worked:

IIS / Windows 10: Aspnet_regiis.exe is dead.

The initial error (which does not involve aspnet_regiis – that was an attempt at a solution) , seen when browsing to a Windows Service:

HTTP Error 404.3 – Not Found 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.

On the path to fixing this, I came across mention of aspnet_regiis.exe. However attempts to execute that returned this:


This option is not supported on this version of the operating system. Administrators should instead install / uninstall ASP.NET 4.5 with IIS8 using the “Turn Windows Features On/Off” dialog, the Server Manager management tool, or the dism.exe command line tool.

Attempts to firstly use DISM.exe as I prefer the command line approach failed with this:

You cannot service a running 64-bit operating system with a 32-bit version of DISM.
Please use the version of DISM that corresponds to your computer’s architecture.

Googling the above shows that this is a complete red herring (64 vs 32 bit). So I abandoned that and went for the GUI option:

After an iisreset (not clear if I needed to do that), I got the result I wanted, this:

Coming back to aspnet_regiis, I don’t know if this had been removed earlier than Windows 10/WS 2012 R2.

IIS Express: what, why, how

What: cutdown, unloved (all official Microsoft documentation references seem to be 6 years older or more), small cousin of IIS. Designed to be used for developer try-outs, rather than any production use, as, for example, it is not designed to be run as a service. You can obviously write a service wrapper, but that doesn’t contradict my point.

Why: on my personal dev laptop, I choose to keep a largely Microsoft world. But as it is an old machine with an OK but small SSD, then those Microsoft things need to be lightweight. A small IIS fits that bill.

How: Download the MSI here. At less than 10MB, that’s what I want. Install.

Where is it? You’ll find no obvious sign of its presence. It’s here:

Now you can just double-click the icon…

which brings up this:

So where is this located, physically?

There is this file “C:\Program Files (x86)\IIS Express\AppServer\applicationhost.config”, which contains this, which seems pretty close:

If I now stick a basic index.html in the empty_wwwroot…

<!doctype html>
<html>
<h1>This is stuff</h1>
</html>

 

Right now, I cannot figure out how a no-argument execution of iisexpress.exe from explorer (x86 or 64bit) determines where to source its website values, e.g. Website1.

So the best path seems to be to execute iisexpress.exe, passing as arguments the full path to the config file, and the name of the site within the config file that you want to access. That def works:

PS C:\Program Files\IIS Express> .\iisexpress.exe /config:”C:\Program Files\IIS Express\config\templates\PersonalWebServer\applicationhost.config” /site:Website1

Little unrelated: PowerShell ref for IIS admin: https://technet.microsoft.com/en-us/library/ee790599.aspx

 

(more editing needed. For now, the screenshots…)

 

 

 

 

PowerShell DSC: Creating IIS things on an Azure VM

I started out with an Azure VM (WS 2012 R2, SQLServer 2016). My aim was to deploy a web application so that the index.html was visible to the external world.

Additions I did not yet manage to achieve in DSC were a) adding endpoints for http and https in ARM, b) setting up self-signed certificates on the host VM. The http part right now is a Must.. the https might be considered optional but sensible.

Right now, this is the exciting output as an external user:

That already highlights one new thing: The UK now has its own Azure data centres… previously I noticed I would often get my browser language in Dutch.

Before I show you the whole of the DSC config, some key points were:

  • the use of the CimSession parameter to Start-DscConfiguration
  • as in a previous post, the need to delete pending configurations… assuming you are sure you don’t want them
  • There seems to be no “Let it be so” option for an existing virtual directory… so might have to replace that with some imperative code.

 

Code here.

HTML5: Referencing one HTML page from another HTML page

I was trying to reference a HTML file B from an HTML file A, without using a server (“server” in this context as in Node or IIS), because I wanted something very lightweight. However, while HTML5 introduces the ability to do such referencing, when trying to do it via a File protocol, it constantly fails with errors stemming from (quite reasonably, I think) restrictions imposed by Cross-Origin Resource Sharing:

In the end, I gave up, and used Node and Express as a light-weight server. Diagram with the key points here – you can download it as SVG for the detail.

Credit due for the Node/Express example here, and for the pointers on HTML5 HTML links here.

 

 

.Net: Hosting a simple WCF service in IIS

This assumes you have read the previous post, which left us with a simple service. However, it was only hosted/running while we were running in debug mode in Visual Studio. We don’t want to be, and can’t be dependent on a running VS instance. This looks at how to take that service and host it in IIS. It does not involve using Visual Studio.


 

This is the folder that contains our code and binaries for the service:

WCFinIIS01

Turning to IIS, this is how it looks before I change things:

WCFinIIS02.JPG

Add an application…

WCFinIIS03

Actually, I shall interrupt this to bring the service files under the inetpub/wwwroot folders – most of them anyway, and then whittle away at them to confirm the minimum set I need:

WCFinIIS04

In fact, I’m fairly confident about that minimum set, so I’ll just go ahead and cull them giving this (note that I have renamed app.config to web.config):

WCFinIIS05

… and the dll.config may go as well, don’t know yet:

WCFinIIS06

Now we go back to IIS and add all that as a new application to the Manager:

WCFinIIS07

OK, and now we have this:

WCFinIIS08

Now, just naively browsing to the root URL for that will get us nowhere:

WCFinIIS09

Reminding ourselves of the content of that root folder shows only 2 files, both of which are important… and wrong right now:

WCFinIIS05

web.config: both the highlighted entries should be removed (but keep a copy of the HelloAcmeService/HelloService entry for the svc file in the clipboard). You will/may need to be in admin mode to edit web.config under the IIS nodes:

WCFinIIS10

AcmeService.svc:

This is wrong in that the Service tag is pointing at the interface, and should be referencing the implementation, that is, IHelloService needs to change to HelloService:

WCFinIIS11.JPG

After those change, this is now what we see if we Browse Website in IIS:

WCFinIIS12

This location will never have a default or any readable web page – it is all about delivering a Service. If we now put an appropriate entry in the URL, we see…

Hm, interesting… this is symptomatic of specifying the interface, not the implementation:

WCFinIIS13

And wadya know, I hadn’t actually saved the change (or maybe the admin rights prevented it) after taking the screenshot. So making sure I press Save after this edit (in fact I found I needed to stop the web site in IIS first):

WCFinIIS14

Now we go again to the URL:

WCFinIIS15

That is good, if it is not obvious. That’s enough for this post, I think. The next post will talk about the wsdl, and using that in SoapUI to test the service from that angle.

 

 

Azure: Billing

As I managed to blow my monthly Azure credits last time by not shutting down instances, I shall make sure that doesn’t happen again.
Billing01

But I shall take checkpoints before doing that…

(sigh…) oh no you don’t. Take a look: evidently the capture is destructive, and you need to run SysPrep first. Not doing that tonight.

So given all my VMs, I need a a PowerShell script to shut them all down. Presumably from a cold start, I need to a) get my subscription, b) enumerate the VMs, c) stop if started, and is there a wait-for-job type command. And lastly do a check on the portal that they are indeed shutdown.

https://azure.microsoft.com/en-gb/documentation/articles/virtual-machines-capture-image-windows-server/

But I have successfully added an http endpoint which works fine, once I’ve installed IIS, and the DNS is obviously working fine, as I can address it by name from a remote machine. Great.

DnsOk01

DnsOk02