Good day!

I am just starting to learn ASP.NET MVC and I cannot understand what the MVC project is compiled into and how to launch it later outside Visual Studio on loaclhost (For example, the Console App projects or WinForms eventually turn into an exe file, which you can run, but I don’t know what the final file for MVC is). I know that in fact, the html index page should open from the browser. But, as I understand it, you need some kind of local server.

I understand that the question may seem silly to you, but I am a beginner and could not find information on the Internet.

Thank.

    4 answers 4

    For example, to run an ASP.NET MVC project outside of the development environment, you will need:

    • IIS server with the required .NET Framework
    • Compiled ASP.NET MVC project

    Read for review:

    There is a lot of information, I attached several links to you for review. Well, as a bonus link, I recommend to read this one:

    • @PavelMayorov, but how to give rights to the directory in which the site will lie? And installing new components, IIS itself, for example. Although it may be redundant, they certainly won't be superfluous :) - Denis Bubnov
    • @PavelMayorov, for installing components on the system, administrator rights are required. And on the pac to give rights to the user IUSR / IIS_IUSRS - Denis Bubnov
    • @DenisBubnov But is it only possible to run a published ASP.NET MVC project on IIS? - Andrei Khotko
    • @DenisBubnov The metanit website details how to publish the application on IIS. I'll try this method. Unsubscribe here when I test it. Thank. - Andrei Khotko
    • @AndreiKhotko, about the launch, let's say, the default launch option is IIS, well, naturally on Windows. But, if you have a Linux-like system, then you can on Apache with additional plug-ins and Mono, but as they say - dancing with a tambourine, and there is not so simple. - Denis Bubnov

    You will need:

    1. Static files (usually Content, Scripts and Views folders - but there can be any)
    2. Folder bin (the same result of compilation)
    3. Web.config file

    You will also need an IIS server. This is a component of Windows, put (in the eight, in other Windows may be called differently) through the "Control Panel" - "Programs and Features" - "Turning On and Off Windows Components". On server Windows, you need the role of "Web server" or "Application server", I do not remember exactly.

    All these files should be moved to the c: \ inetpub folder, its subfolder - or to any other place.

    • If you copied files to the root inetpub - your site can already work.
    • If you have created a subfolder, you need to go to the IIS settings, find the folder there, right click on it and select "Convert to application".
    • If you put the file somewhere else, you need to create a website or application, and specify the virtual and physical paths for it (the virtual path is the address of the site, the physical path is where its files lie).

    There is a way to automatically copy into the output folder the tree of files required by the web server, so as not to search for them manually. To do this, you need to build a project from the command line via msbuild with the "/ t: PipelineCopyAllFilesToOneFolderForMsdeploy / p: Configuration = Release / p: WPPAllFilesInSingleFolder = path \ to \ output \ folder" keys

    You can also get an archive with these files suitable for deployment via msdeploy (IIS management service) - to do this, specify the "/ t: Package / p: Configuration = Release / p: PackageLocation = path \ to \ output \ folder" keys

    In addition, if you just build a project with the key "/ t: Package", then all the files in one place can be found along the path obj * \ Package \ PackageTmp

    Also, a set of files for deployment can be obtained through the studio itself, by clicking on the project, right-click and selecting the "Publish ..." ("Publish ...")

      Source code is compiled into executable files. You can see for yourself what you end up with if you “publish” a project.

      enter image description here

      Since this is a web application, you need a server for it to work. VS uses an IIS server, so you can try deploying a project on IIS.

        Hello!

        All ASP.NET web applications run on a web server. In a Windows environment, this is IIS, a web server from Microsoft. As a rule, it is not installed on regular users' computers, but it can be added at any time from the Windows components.

        After it is installed on the right computer that will act as a web server, the server will need to be configured, a site will be created in it, and then the project will be published.

        Here read about the IIS setup https://professorweb.ru/my/ASP_NET/sites/level3/3_1.php