MVC Durandal app doesn't work when deployed to IIS - iis

The platform is IIS on Win8.1
The project is created from the Durandal project template. No changes are made, and the project is run: the Durandal start kit appears in a web browser.
The project is deployed to a folder D:\Client
IIS manager is used to map a virtual application off the default web to D:\Client. The app pool for this is specified as DefaultAppPool which on my machine is set to FX4.0 and runs with my user credentials. Deliberately setting it to FX2.0 produces a 502 as expected. This implies that the FX version is not the problem.
http://localhost/Client produces the splash screen but the app hangs there. Using the browser's own debugger reveals that main has NOT been executed.
Loaded:
bootstrap.js
jquery-1.9.1.js
knockout 2.3.0.debug.js
require.js
Has anyone experienced this and what did you do to resolve it?

Virtual Directories are created to serve static content as far as I understand. ( Just a subfolder of another application ). As the StarterKit runs using MVC4/5 you need also ASP.NET support thus creating a normal application ( parallel to defaultapp ) should do the trick.
If you did that already that way maybe you're missing some files. Had a situation where some files weren't deployed ( eg. the views folder ). Double check if those are present.

Related

My iis automatically points my solution directory though it's published

I have published my IIS application to C:/inetpub/wwwroot/appDirectory and it's have different configuration in web.config file.
and in development version solution directory i have another web.config file and When i build solution my IIS start pointing to solution directory.
that's too annoying, every time i need to remove application from iis and again make application on IIS itself.
Go to properties of your web service in Visual Studio.
Navigate to Web tab
Either Change the local IIS to express or you can give a different application name so it wont replace your deployed application.

How to configure an MVC6 app to work on IIS?

So I'm building an MVC6 app in Visual Studio 2015 and have managed to figure most stuff out, however, I haven't yet worked out deployment.
In MVC4 (what I was using before), our process* was publish to a folder, then setup the website in IIS (Right-Click on Sites -> Add Website).
Actually, our process is set it up in IIS and TeamCity, but not for test apps like this :).
I followed this process and obviously it's trivial to setup the IIS website and publish to the correct folder...but that does not actually work for me.
We're running IIS 8 on Windows Server 2012 and we've installed the .Net 4.6 runtime on the server.
The following steps have worked for me and should help you host your project on IIS.
Using Visual Studio 2015 Preview as your IDE,
Create an ASP .NET 5 Starter App.
Check that it is working outside of IIS.
Once complete, publish the application. In this example, I have selected the location C:\PublishWebApp.
3.1. When publishing your application, make sure that you have:
Disabled precompilation
Selected amd64
(See image below)
Upon a successful publish, go to C:\PublishWebApp.You should see the folders approot and wwwroot inside.
Now open the IIS Manager (I am assuming you have the ASP .NET 4.5 feature enabled)
Create a new website.
6.1 : Select the wwwrooot folder as the website's physical path. In this example, it is C:\PublishWebApp\wwwroot.
Check the website to see that it is working. If you encounter any errors, please post them here.
If the precompile option is ticked in the Publish Web Settings window pictured above, then you must
Go to the wwwroot folder of your published web application. In this example, it is C:\PublishWebApp\wwwroot.
Locate web.config.
Inside the folder of your published application, there is an packages folder inside of the approot folder which should contain a folder named after your application, with a folder for the version underneath. Inside that folder should be a folder named root. In web.config, set the value for the key kre-app-base to the root folder. For reference, see the line of code below. In this example, the application name is WebApplication10.
<add key="kre-app-base" value="..\approot\packages\WebApplication10\1.0.0\root" />
I Spent hours on debugging the issue finally got it worked, steps:
1) Publish your MVC6 application using visual studio into file system, make sure you are selecting correct DNX Target version in my case its dnx-clr-win-x64.1.0.0-rc1-update1.
In the output folder map "wwwroot" folder to your applicaiton in IIS (DO NOT Map it to sup-applicaiton, only ROOT application in IIS works with DNX for example "Default Web Site").
I have just spent a day trying to get this working. i found this here (search for posts by GuardRex) invaluable, complete the steps the accepted answer gave, that's the start of it.
Pretty much if you try to add an application to a site there is bunch of workarounds and extra configuration needed that is detailed in the link.
For starters:
1)Make sure you have the HttpPlatform handler installed here
2)Seems obvious but make sure .net5 is installed on your server here
I know this is if you are adding an application to a site, but there's some pitfalls and much needed refinements needed for the deployment process at the moment that everyone should be aware of.

IIS changes the physical path to application it self

I have set two websites in my IIS 8.5. I have one for production version and one for development (need this for the team work purposes). The structure is simple. Website is simple static page using BackboneJS and API calls to get all the data. All virtual paths and applications were set at the beginning manually by my self. For some reason some API calls didn't worked in dev site. I found out the physical path to the API project has changed. Do you have any idea, where can be the problem? Actually some of my collegues face this issue too.
Only think that cames to my mind is that when bdebugging the API, I use "Attach to process" in Visual Studio, where I connect to the correct IIS process - w3wp.exe with user name IIS APPPOOL\Dev or IIS APPPOOL\Prod according to the site I'm debugging.
Nevertheless I don't think the path should change itself. Where can be the problem? Does anyone have any idea how to prevent this strange behaviour?

IIS doesn't notice updated controller

On IIS 7 I have an application running which uses Entity Framework Web API.
When I copy and replace one of the .cshtml (HTML and JS) files in the Views folder, the change is applied instantly.
But when I replace one of the controllers, changes take no effect.
I restarted the IIS using the GUI, via Run | IISReset command and after this didn't work even restarted the computer. However, IIS still uses the old version of the controller.
How can I make IIS "recompile" the project and use the new controller version?
Update: Replacing the bin directory helped me out. Is there still another way to recompile directly on IIS?
Mvc is web application and precompile is available only on website projects
Compilation
Web application projects
You explicitly compile the source code on the computer that is used
for development or source control.
By default, compilation of code files (excluding .aspx and .ascx
files) produces a single assembly.
Web site projects
The source code is typically compiled dynamically (automatically) by
ASP.NET on the server the first time a request is received after the
site has been installed or updated.
You can precompile the site (compile in advance on a development
computer or on the server). By default, compilation produces multiple
assemblies.
More info

Do serviceAutoStartProviders run in combination with App_Offline.htm?

I've been looking at the 'Application Initialization' module for IIS 7.5 (which is baked in to IIS 8) and serviceAutoStartProviders which can be set to initialize services when an app loads up.
I'm wondering what happens to serviceAutoStartProviders when an app has AppOffline.aspx, to bring down the app for whatever reason. Do the providers still run, or no? In my case, I have a provider that I would not want to run while the app is being updated - and I use AppOffline.aspx while I'm updating the app.
A quick test, it appears that serviceAutoStartProviders do run even if App_Offline.htm is found in the application directory.

Resources