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
Related
So I made a Net Core Web app project with razor pages and javascript files, as you can see on the right of the first screenshot, but I cannot seem to publish it as a web app, only console app or windows application.
For instance, when I publish it to folder, it does not even publish my razor pages, no index.cshtml at all.
Anyone ran into this issue before?
Project properties screenshot
Published folder
Inside wwwroot folder
Razor pages .cshtml files will be embedded into the web.config file after publishing.
It seems like you are using a regular Linux FTP. Make sure you are using a windows server to publish your app on. Net Core does not work on Linux servers unless you install the Net Core runtime on the server.
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.
I have asp.net mvc 5 application and websetup project in a VS2013 solution. I have added the asp.net mvc5 application as the Project output for the web setup project. Now I have web.config files for Areas, Views section. I have set them with Build Action = Content and Copy to Output Directory = Copy Always. On building the web setup project and deploying it to web server ,I see that there are no web.config files for Areas, Views section in the output. Can anyone help me to know how to resolve this issue ?
The typical setup for an ASP.NET web project does not require copying the web.config to the build folder.
You could selected Build Action "Content" and Copy to Output Directory "Do not copy"
If you Publish your project, the content files will be published. They will not be placed in the bin folder, but rather alongside the app where IIS expects them. The publish step may produce output similar to the following.
Publishing folder bin...
Publishing folder Content...
Publishing folder Scripts...
Publishing folder Views...
Publishing folder Views/Home...
Publishing folder Views/Shared…
If you must use WebSetup (instead of Publish) to deploy the web app, you will want to add the necessary files to the WebSetup FileSystem tab (including content and output).
I have been deploying ASP.NET MVC 3.0 on Win 2k8 on IIS 7.5 with "Web Deploy" option.
In one of the application folder I have "CSV" folder, I have got few of the CSV template files in the folder. When I depoly the application, neither the folder gets created on the server nor any files get copied.
What is the reason and what is the fix?
Move your files into the Content folder (to avoid issues with the default routes)
Select them in Solution Explorer
Right click and select Properties
Change the Build Action to Content
After following these steps, your files should be deployed with your application.
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.