Monthly Archives: December 2018

Publish .NET MVC to File System

Assuming that SQL Server is installed, SQLExpress will work too, the following shows how to publish an application to a local file folder and make that accessible across the local network. It will also specify an instance of SQL Server, not the default LocalDb. I found this useful to quickly demo a prototype for managers and get their feedback using just the IIS on my computer and our local network. Note that the steps here open up the app to everyone on the network, so it would not be useful if confidential information were involved.

  1. Create the connection string in Web.config
  2. Publish the app to a folder
    Publish App
  3. Assign that folder a name in IIS
    IIS Add Application
    IIS Add Address
  4. Share the folder with Everyone. Navigate to your folder location. Right click it and click Give Access To > Specific People… Select Everyone from the drop down list and click Add, then Share
  5.  Turn on ASP.NET 4.7 (if not already enabled)
    Turn On Features ASP.NET
  6. Create a SQL Login & User with permissions. The username from the connection string needs to be created and granted access or you will be faced with an error: Login failed for user ‘Foo’. Oddly, I found that when using Windows Authentication, the username was the machine and not the user’s domain account.
    Failed to LoginSQL2014 LoginDB UserMapping the User Login should create a User for the DB as well.
    DB UserAnd if it tells you that user you just made cannot login, check the SQL Log. SQL Log

    And continue to troubleshoot.

  7. Enable SQL Server Authentication if not on

    SQL Server Authentication

  8. Now you can navigate to localhost/BookStore
    Create AuthorUntil next time…

Windows Process Activation Service Could Not Be Started

I began today by starting a different post about publishing an app to localhost. Things soon went sideways. That post will have to wait while I peel back this onion:

Localhost can't be reached

When I open up IIS, I can see that the Default Site and the DefaultAppPool are stopped. No problem, let’s start them.

App Pools Cannot Be Started

You knew it wasn’t going to be that simple, right? From an admin command prompt:

Now, WAS and IIS are both installed, so I follow the recommendation from iis.net to go ahead and reinstall them, but save yourself the restart. That didn’t do it.

Windows FeaturesI’m not eager to Regedit based on a StackOverflow answer, but it’s simply removing a file and Scott Hanselman’s foray into PerfMon lead me to several errors, but they did not get me closer to a resolution. I’ve reinstalled WAS once, so I deleted NanoSetup.

WAS Parameters

Now the App Pool can be started, but we’re missing one last step to turn on the DefaultSite.

Manage Website Start

W3SVC Is Stopped

One more Admin Command Prompt later and we’re there.

Now, we can navigate to localhost in the browser.

Welcome IIS