How do I deploy a .net core 1.1 app to IIS? - visual-studio

I right-clicked on the project and selected Publish. I chose Folder as the target and VS 2017 published it to that folder.
I want to copy the output to IIS so that I can host it. Which folder should IIS point to in the output?
The output contains a bunch of folders and I've tried to get IIS to point to some of them without any success. In addition, I am not seeing a default.htm or anything traditional like that.
So where should IIS point to?

You will need to copy whatever you see inside the screenshot under PublishOutput to a folder in web server. For example, C:\inetpub\wwwroot\yourapplication.
Then in IIS, Add Website or Add Application depending on your requirement.
In addition, you will need to install .NET Core Windows Server Hosting bundle on the web server.

Related

How to deploy the entire project to IIS

I'm trying to publish my ASP.NET Core 5 MVC application from Visual Studio to IIS Web Server (on VPS). But all my Areas folders, Cshtml files, view components etc, have not been published - only the wwwroot folder and its contents have been uploaded to the server. I saw about project.json, but .NET 5 doesn't use it anymore.
PS: when I try publishing clicking directly from the "Area" folder selected, the files are published, but the .Cs files are published too.
How can I fix it?
On publishing to Microsoft Azure, everything goes fine. But to my VPS it is not working as I would like to.
The easiest way is open scm site, check the publish file under D:/home/site/wwwroot. And compare the structure of deployed file between azure and IIS. It should be same.
After the comparison, see if the folders or files are not included. Just modify it in the .csproj file.
Related posts:
1. Unable to find files located in my root project folder when hosted on Azure
2. dotnet core publish: include/exclude dir in output

How to deploy a Web API to my web host?

I'm building a RESTful Web API on my local machine and it works nicely. I want to put it on my GoDaddy web host account now. I did this once by copy and paste file by file to the FTP site they gave me. That worked, but it is slow and painful to do and to update when I make changes. Is there a quicker way to publish (in Visual Studio) from my local copy to my FTP site? If not, can you tell me which files I need to deploy for the Web API to work? I don't think it needs all the .cs files, but I'm not sure what files it must have.
OK, I found this link about publishing a website in Visual Studio:
https://msdn.microsoft.com/query/dev14.query?appId=Dev14IDEF1&l=EN-US&k=k%28WebApplicationProjects.PackagePublishOverview%29;k%28TargetFrameworkMoniker-.NETFramework
It didn't really solve everything for me, but I started playing around with the controls in Visual Studio. I was able to publish my local website to FTP by right-clicking on the project node in Server Explorer and click Publish... or click Build -> Publish in the Visual Studio menu. Fill in your FTP connection information, enter the target folder under Site Path and leave Destination URL blank (don't know, don't care). I also unchecked "Include all databases..." in the Project Properties Page for Package/Publish Web because I didn't want to rebuild my destination database. It worked.

publish MVC 3 app to localhost IIS 7

I have searched a lot and I have tried but couldn't published asp.net mvc 3 application on localhost. I have never tried before. I have currently adminpanel application running on development server of the visual studio. In my machine, following are installed:
IIS 7
windows 7
SQL server 2008
MVC 3
asp.net 4
In visual studio, I publish application using File System publish method and target path to C:\inetpub\wwwroot\adminpanel. And Following Directory and files were copied.
Directory
App_Data
bin
Content
Scripts
Views
Visual Studio 2010
Files
Global.asa
Packages.xml
Web.xml
I don't know but I think Some directory's are missing like the controllers, Helpers, Models, Sources which I have seen in Visual Studio Solution Explorer. When I browse to http://localhost/adminpanel, it shows all directory and files list in browser.
How to publish the application to IIS and use SQL server of local machine so that I can browse to particular controller like http://localhost/User/UserManager which I can do in the dedicated server of the visual studio.
I don't know but I think Some directory are missing like controllers,
Helpers, Models, Source which I have seen in Visual Studio Solution
Explorer.
That's perfectly normal. ASP.NET MVC 3 uses an ASP.NET application type (in contrast to ASP.NET WebSite) meaning that it is precompiled and all the source code is removed when deploying. Only the Views, Static resources such as CSS, Images and Scripts as well as the bin folder containing the compiled assemblies is deployed.
Basically, I think your Site has not been defined as a application in the IIS. You can do it from IIS manager.
But, instead, when you publish the the application, select File System but instead of browsing to the mentioned Folder, in Target Location field click the button next to the text box and select Local IIS on the left side. Now you can create a Application Folder and directly publish into it.

Every time I open my project I have to create virtual directories

I am currently working on a solution which has an ASP.NET application and a Web Service. Whenever I open this solution I get the message that the virtual directories for this project have not yet been created and must be to continue. The problem is, if I hit OK, it cannot create the directories because they already exist and then I cannot load the project. Looking in IIS I can see that the virtual directory exists in C:/Inetpub/wwwroot/ProjName. If I delete this from IIS, I can then open the project, but it creates the virtual directory in C:/location of project folder. When it uses the project's location, I am not able to connect to the site or the web service.
The same thing happens on XP with IIS 5.1, VS 2010 and Server 2003 with IIS 6.0, VS 2010. Similarly, it happens on colleague's machines, so I am convinced that it is a setting in VS, and not IIS or my machine.
Right now, my solution is to delete the virtual directories, open the VS solution, delete the virtual directories, and publish the projects with the publish toolbar in visual studio (not the web tab in project properties).
I fear that I've at some point messed up a setting on both of the projects, but it has been some time since I've been working around this. I've scoured all of the settings and I can't find anything that fixes this behaviour. I need to pass the project along to someone else, and I feel as if the work around instructions may be confusing so I want to fix this.
I used to do things similarly back in the days when VS didn't have its own dev server - re: directly work on web projects in a local version of IIS (if memory serves, this was called "Personal Web Server" or PWS - am I advertising my age?)
Anyway, I haven't (thankfully) done that since VS (2005?) got its own dev server...
Try this process in VS 2010:
You can develop your solution on any local folder in your file system. You can run/debug your solution from VS (ctrl f5 or f5 respectively) - it will use VS dev server by default. Your development machine doesn't even need to have IIS...
After you are done developing and debugging (using VS and its dev server), you can publish to IIS or even to some other "publish folder" in your (local) file system, and simply copy the files to whatever (local/remote) IIS virtual (ASP.NET application) folder you prefer.

Problem running MVC3 under IIS 7.5

I am trying to make Visual Studio 2010 to run my project under a local instance of IIS 7.5 instead of starting the web development server. There is no problem deploying it to IIS, but when i try to browse to the site, it's like the routes never been registered in IIS because i get error "The Web server is configured to not list the contents of this directory." when i try to browse "http://localhost/returnjson", and when i browse "http://localhost/returnjson/Home/Index" i get error 404. And there is nothing wrong with the routes in my project, it works under web development server. What could be the problem?
It's hard to say what's wrong here but there are a couple of things you could try.
You could be looking at the wrong application. IIS comes pre-configured with a default application that acts as a catch all. Any unmapped domain name will end up there. So, by default when you visit localhost you'll end up there.
If you deployed your application into a new IIS site, make sure you bind it a proper domain name like myapp.local. Then add that domain name to your hosts file (%Windows%\System32\Drivers\etc\hosts) and map it to IP 127.0.0.1.
Another thing that could be wrong is that your IIS configuration is a bit screwed up. It happens sometimes. You can fix that with aspnet_regiis like so:
aspnet_regiis -ir
This tool is located under:
%Windir%\Microsoft.NET\Framework\v4.0.30319
Right click on your MVC3 project and select Publish. Publish it to the Filesystem and select a folder on your hard drive.
Navigate to your published folder and copy everything in it.
It's a pain in the keister but you can get through it.
Your folder in C:\inetpub\wwwroot should look like this after pasting your published application into the wwwroot:
Can you confirm that your folder looks like this?
You could also try out IIS Express in stead of IIS 7.5
IIS Express is a lightweight, self-contained version of IIS optimized for developers. IIS Express makes it easy to use the most current version of IIS to develop and test websites. It has all the core capabilities of IIS 7 as well as additional features designed to ease website development

Resources