简体   繁体   中英

Activate MVC Web site on IIS 7 Windows Server 2008 R2 Enterprise SP2

I have create a new ASP.NET Core 2.1 project empty on Visual Studio 2019

This is generated by a line in the Startup.cs file

public class Startup
{
    // This method gets called by the runtime. Use this method to add services to the container.
    // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
    public void ConfigureServices(IServiceCollection services)
    {

    }

    // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
    public void Configure(IApplicationBuilder app, IHostingEnvironment env)
    {
        if (env.IsDevelopment())
        {
            app.UseDeveloperExceptionPage();
        }
        app.Run(async (context) =>
        {
            await context.Response.WriteAsync("Hello World!");
        });
    }
}

The application can serve static files HTML from the wwwroot folder.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title></title>
</head>
<body>
    <p>test</p>
</body>
</html>

The project working on localhost

在此处输入图像描述

I need published it to a folder on remote server with SO Windows Server 2008 R2 Enterprise SP2.

I had IIS 7 installed on server.

I installed.Net 4.5.2 and asp.net 2.1 core runtime and asp.net core 3.1 runtime on the server 2008 R2 SP2

I copied the folder contiaining my published Web site to \inetpub\wwwroot on the server.

With this post I configured MVC website in IIS.

https://www.codeproject.com/Articles/1168712/How-to-Quickly-Configure-your-MVC-Website-in-IIS

在此处输入图像描述

But on the server the return is

在此处输入图像描述

When click on wwwroot project folder

在此处输入图像描述

What do I do to give the Web site a URL and otherwise make it active as a Web site?

Maybe I have to install more on the server?

在此处输入图像描述

update

Installed on the server

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

it finally worked thanks to everyone for the support and help

在此处输入图像描述

We should use DotNet build , DotNet publish command to publish our website rather than copy the project file to the website directory.
https://docs.microsoft.com/en-us/aspnet/core/tutorials/publish-to-iis?view=aspnetcore-3.1&tabs=netcore-cli
In Visual studio , we just need to use the below menu to publish website since VS is a strong, powerful IDE.
在此处输入图像描述
Select folder and type the physical path of the website.
在此处输入图像描述
At last, we need to install the corresponding Asp.Net hosting bundles(2.1 version instead of 3.1) in order to host Asp.net core web application in IIS.
在此处输入图像描述
Result.
在此处输入图像描述
Feel free to let me know if the problem still exists.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM