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

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.

Related

Draw.io IIS Virtual Directory

I am struggling to make the necessesary configurations to run the Draw.io Asp.net samples (https://jgraph.github.io/mxgraph/dotnet/index.html). According to the docs To run the ASP.NET examples in IIS, a virtual directory must be created that maps /mxgraph to the top-level directory of this distribution. To do this I have opened an IIS Manager and in Default Web Site I have added a virtual directory called mxgraph however, this did not solved the issue. Also, I have tried to create new Web Site in IIS and mapp to mxgraph folder which again di not work. Anyone has a clue how to make this work?

How to restart a dnx website in production?

I updated a ASP.NET CORE/ASP.NET 5 RC1 controller cs file with a programming change.
The site has previously been deployed on production on IIS7.5 Windows 2012 Server which makes use of HTTPPlatformHandler installed in IIS.
This is a remote server I have to access via VPN.
The site is setup as an application in IIS and the folder points to the wwwroot directory of the deployed site.
I deploy it currently by deploying it first locally by right clicking on my project in Visual Studio 2015 and selecting publish to local folder. I then copy the contents of the local folder to the remote network IIS7.5 web server site folder.
If I copy for example the appsettings.json or a changed .cs file to the server, the change will not reflect.
If I copy the whole site to the production server I get folders and files in use messages. I have to kill the 'dnx' process in order to copy without getting these messages.
From my understanding if I kill the process dnx it will force a recompile. This is currently the only way I know of to restart the site after updating it but I imagine it is not the best way.
What is the standard practice to restart your website after you update your production sites that run ASP.NET5 RC1?
Also changing my app.settings json file aslo doesn't trigger a site reload like changing the web.config did in ASP.NET 4 so being able to restart a site is important.
If I have multiple sites on the same app pool and I only want to update one in production. How can I only restart the one site to reflect the latest changes?
Is it possibly to restart the website to reflect the change as updating it directly doesn't cause a recompile taking into consideration if I only have access to a shared folder and not the web server itself?
With IISPlatformHandler, DNX process is started by IIS (instructions are in wwwroot\web.config).
IIS knows nothing about your source files, all requests are forwarded to DNX.
DNX does NOT watch source files for changes, because there is no dnx-watch there.
IIS only watches for wwwroot\web.config file changes, so you need to change/edit/touch it to force IIS to restart website (and DNX process).
I use msdeploy to deploy, it has commands to stop and start app pools, using these commands has resolved my file in use errors. There are lots of ways to use msdeploy, below is how I happen to be using it.
msdeploy -verb:sync -source:recycleApp -dest:recycleApp="site/pool",recycleMode="StopAppPool",computername=COMPUTERNAME
msdeploy -source:contentPath='SOURCE PATH' -dest:contentPath='\\COMPUTERNAME\wwwroot\' -verb:sync -retryAttempts:2 -disablerule:BackupRule
msdeploy -verb:sync -source:recycleApp -dest:recycleApp="site/pool",recycleMode="StartAppPool",computername=COMPUTERNAME

Running nodejs/MEAN app on IIS virtual directory setup

I am running my MEAN app on windows. So far I was running the application on Non-Sucking Service Manager as a windows service. Now we need to enable windows authetication and we are planning to use IIS.
We are planning to use IISNode for this. So far I have read this post.
I installed the samples that comes with IISNode by running setupsamples.bat file.
running this file typically creates a virtual directory # C:\Program Files\iisnode\www
I want to understand If I need to run my application, Do I always need to copy all the content under C:\Program Files\iisnode\www folder? Or I can create a new virtual directory and make it work ?
I answered a similar question to this here
IISNode allows you operate your Node.js app just like you would any other application in IIS. Just make sure you have IISNode, Node.js, and the Url Re-write Module installed on the environment as well as a Web.config for your app and you should be good to go. Without the URL Re-write module then you would have to go to http://host:port/app.js/ instead of http://host:port and IISNode takes advantage of it to accomplish this.
In that thread I have a template Web.config that I use with all my IISNode services/web apps. It will support all aspects of hosting in IIS, including hosting your app in a Virtual Directory. Just make sure that the main file for your app matches the main file referenced in the config file within the URL Re-writing section.
If you are using VS then I recommend downloading the Node.js Tools for Visual Studio. It helps with creating the Web.config that you need for IISNode.

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.

Does ASP.NET MVC 4 application have to be in the root folder of a site on IIS 8?

iI have a ASP.NET MVC 4 application based on the VS 2012 Basic template. Using VS 2012, I can deploy the app into a root of an IIS server, such as c:\inetpub\wwwroot. Then, I can go to [http://]mymachine/ and see the app.
But, if I try to move the app to c:\inetpub\wwwroot\Test, an attempt to access [http://]mymachine/Test results in "HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory."
I tried to move the folder both manually, and also by deploying to that folder from VS 2012, but there was no difference. I tried to move the web.config file into c:\inetpub\wwwroot while leaving the rest of the app under c:\inetpub\wwwroot\Test, but that also doesn't work. I have to move global.asax, global.asax.cs and the bin folder into the site root, but then the whole app is again in the root folder, which is not what I wanted.
Does anyone know whether what I'm trying to do is possible? Thanks.
PS.: Sorry about the link formatting - I used the square brackets around [http://] to prevent stackoverflow from treating the example URIs as links.
You need to ensure that the sub-folder has been converted (or created) as an application in IIS. Load the IIS manager and locate the folder under the website node in the tree, right-click and select convert to application. If it's not listed, use the add application option.
Keep in mind that the child application will inherit web.config settings from it's parent by default (among other things). More information can be found on MSDN.

Resources