publish MVC 3 app to localhost IIS 7 - asp.net-mvc-3

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.

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

Visual Studio Net Core Web App: No option to output as web app in project properties?

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.

Setting Up Visual Studio 2008 Web Site Project In Visual Studio 2010

My development machine was recently upgraded from XP/VS 2008 to Windows 7/VS 2010. I have a Web Site project that I need to continue to run as a Web Site (as opposed to Web Application Project) in 2010. Ideally I'd like the solution files to be in the web root of my system (C:\Webs), but if they're in My Documents, that's fine.
The important part is that I have a folder (called Data, off C:\Webs) that contains roughly 20 GB of .rft and .pdf files, etc., which needs to be on the web root, so the application can access those files, but NOT be part of the build process.
I tried setting up a new blank web site, with the solution in My Documents, but the problem is that when I dragged and dropped the folders from my webs directory (where I need to be running from) into the Solution Explorer window, the actual files were duplicated and copied into the My Documents folder, rather than a "pointer" to the files.
Can someone please tell me how to set up a new Web Site-style project in VS 2010 and include the files from my Webs folder, while allowing me to exclude my Data folder from the overall project, but have the files in it be accessible by the code?
Thanks!
Mike

Why Visual Studio 2010 publish website with source code?

I'm using Visual Studio 2010 with the new website publish dialog. I have a Web Application website. When published, in theory it should compile all the code into an single assembly. However, in both Debug and Release, after publishing the directory always contains source code of page and user controls (even with the untransformed web.config files Web.Debug.config and Web.Release.Config). This is very confusing.
But with package/publish web project configuration and Generate Deploy package context menu item, the Package\PackageTmp directory is clean.
Why doesn't Visual Studio use this Package to publish the website?
Where is the precompile option?
Web.config xml transform seems not work, why does Visual Studio bring this feature to confuse me?
The correct answer is to look in the Package/Publish Web settings (in the web application project properties) and look for the "Items to deploy".
For a web application you'd want "Items to deploy" to have "Only files needed to run this application" which would NOT copy the source code files, since they've been compiled into the DLL in the bin folder.
Note that this setting varies for your current Build type (Debug/Release/etc), so plan accordingly...
Ciao!
You need to understand the differences between Web Application Projects versus Web Site Projects.
To deploy a Web application project, you copy the assembly that is
created by compiling the project to an IIS server. In contrast, to
deploy a Web site project, you typically copy the project source files
to an IIS server.
For Web application projects, you typically build the project in
Visual Studio or by using the ASP.NET batch compiler on a computer
that is not the production IIS server. All code-behind class files and
standalone class files in the project are compiled into a single
assembly, which is then put in the Web application project's Bin
folder. (The .aspx and .ascx files are compiled dynamically in a
manner similar to what is done for Web site projects.)
For Web site projects, you do not have to manually compile the
project. Web site projects are typically compiled dynamically by
ASP.NET (on both the development computer and the production IIS
server). You can choose between batch compilation mode, which
typically produces one assembly per folder, and fixed compilation
mode, which typically produces one assembly for each page or user
control.
In visual studio 2013/2015, select an option "Precompile during publishing"

How to run an ASP.NET Application on Another System?

I have developed an ASP.NET web application in visual studio 2008. I want to run the same application on another system, but Visual Studio is not installed on that system. Is there a way I can run without visual studio?
I heard about deploying, but I don't know much about it.
You can publish your site from Visual Studio to a server that's running IIS, more info here:
How to: Publish Web Application Projects
You can use the built-in deployment features of Visual Studio (right click on the web project, select publish and follow the prompts) or you can simply copy all the dlls plus your content files from the web project to the IIS folder you want to deploy to (known as xcopy deployment). You could also deploy via a setup project, which will create an MSI package, but that's a bit more work. Here's a couple of links that might help, but you can do a search for the options described above and you will find plenty of resources:
Deploying ASP.NET Applications - Part 1
Deploying ASP.NET Applications - Part 2

Resources