Asp net windows server 2012 r2

To configure ASP.NET (must be ASP.NET 4.5 for FIPS compliance) for Windows Server 2012 R2:

  1. Start Server Manager.
  2. From the Manage menu (top-right menu bar), select Add Roles and Features.
  3. On the Before you begin, page click Next.
  4. On the Installation Type page, ensure Role-based or feature-based installation is selected and click Next.
  5. On the Server Selection page, ensure the local server is selected and click Next.
  6. On the Server Roles page, check the Web Server (IIS) server role.

    Server Roles

  7. In the dialog, click Add Features to add the features required for Web Server (IIS).

    Add features

  8. The Web Server Role (IIS) page is added after the Web Server (IIS) is checked on the Server Roles page.
  9. On the Role Services page under Web Server Role (IIS), expand the Security node and check Windows Authentication.
  10. Expand Application Development and check the ASP.NET 4.5 node (this also checks a number of other options, such as ISAPI Extensions and ISAPI Filters).

    Select role services

  11. When you select ASP.NET 4.5 you will be prompted to add features related to that role. Click Add Features in the dialog to add all the features.

  12. After you have made the necessary changes, click Install to begin the role installation. Installation progress is displayed while the components are being installed.

    Install

I deployed my .NET Core project to Windows Server 2012 R2 64-bit and this happened:

enter image description here
HTTP Error 502.5 — Process Failure according to Microsoft guide, they said that it is because of platform conflicts with RID.

(https://learn.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x#common-errors)

I had already come through every step in that guide but can not fix it. So anyone knows how to fix this? I would be appreciated if you could. Thank you.

Note: I had already give publish folder full permission and also installed ASPNetCoreModule v2.0, net core sdk 2.0. My IIS version is 8.5.

Here is my .csproj:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <RootNamespace>_MyAppAPI</RootNamespace>
    <AssemblyName>_MyAppAPI</AssemblyName>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <DocumentationFile></DocumentationFile>
  </PropertyGroup>

  <ItemGroup>
    <Content Remove="wwwrootswaggerauthenbasic-auth.js" />
    <Content Remove="wwwrootswaggeruicustome.css" />
  </ItemGroup>

  <ItemGroup>
    <Folder Include="Middleware" />
    <Folder Include="Logs" />
    <Folder Include="Modelsappapi" />
    <Folder Include="wwwrootlib" />
    <Folder Include="wwwrootlogs" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" />
    <PackageReference Include="Serilog.Extensions.Logging.File" Version="1.1.0" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
  </ItemGroup>

  <ItemGroup>
    <EmbeddedResource Include="wwwrootswaggerauthenbasic-auth.js" />
    <EmbeddedResource Include="wwwrootswaggeruicustome.css" />
  </ItemGroup>

</Project>

And web.config after build:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments="._MyAppAPI.dll" stdoutLogEnabled="false" stdoutLogFile=".logsstdout" />
  </system.webServer>
</configuration>
<!--ProjectGuid: 2510f4bb-368b-4ab2-96e1-5d06b14d677e-->

I ran into this: IIS fails to run ASP.NET Core site — HTTP Error 502.5

Seem to be exactly my problem. But I cannot find an .exe file anywhere

RRS feed

  • Remove From My Forums
  • Question

  • Is it possible to have ASP.NET 4.7 for IIS on windows 2012 R2? Only have option for 4.5. I tried to install .net 4.7.2 but then it says it is already installed?

All replies

    • Proposed as answer by

      Tuesday, September 24, 2019 2:08 PM

  • Hi, I tried that link and I get this message:

    .NET Framework 4.7.2 or a later update is already installed on this computer.

  • When I go into add features and roles. Only ASP.NET 3.5 and 4.5 are available.

  • Hi

    For your first question:

     “Is it possible to have ASP.NET 4.7 for IIS on windows 2012 R2?”

    The answer is YES and .NET Framework 4.7 can be installed on Windows Server. You can refer to the following picture:

    More details you can refer to the following link:

    .NET Framework versions and dependencies

    https://docs.microsoft.com/en-us/dotnet/framework/migration-guide/versions-and-dependencies

    Besides, the second question:

    .NET Framework 4.7.2 or a later update is already installed on this computer. When
    I go into add features and roles. Only ASP.NET 3.5 and 4.5 are available.”

    Try the following steps:

    1. Check your windows update whether is up to date, if not, try to update it;
    2. Run registry and navigate to: HKEY_LOCAL_MACHINESOFTWAREMicrosoftNET Framework SetupNDPv4Full, check for a DWORD entry named Release. Its value is a release key that corresponds to a particular version of the .NET Framework. In the following figure,
      for example, the value of the Release entry is 461814, which is the release key for .NET Framework 4.7.2.

    If your release value is same as me, you don’t have to install any extra .net.

    Please feel free to let me know if it works.

    Best regards

    Kiki Shi


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact
    tnmff@microsoft.com.

    • Proposed as answer by
      Kiki ShiMicrosoft contingent staff
      Monday, October 7, 2019 1:45 AM

  • When I go into add features and roles. Only ASP.NET 3.5 and 4.5 are available.

    by default you can only add these but i’ve already sent the link to donwload and install it seperatly 


    Vote or mark as answer if you think useful

  • Hi,

    I am very happy to help you. Would you mind letting me know the update of the problem?  If you think the answer
    is helpful, please mark it as a reply, which will help more users get valid information.

    Have a nice day=.=

    Best regards,

    Kiki Shi


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact
    tnmff@microsoft.com.

  • Hi,

    As this thread has been quiet for a while, we will
    propose it as‘Answered’as the information provided should be helpful.

    If you need further help, please feel free to reply
    this post directly so we will be notified to follow it up. You can also choose to unmark the answer as you wish.

    Best Regards

    Kiki Shi


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact
    tnmff@microsoft.com.

By Luke Latham and Rick Anderson

Sections:

  • Supported operating systems
  • IIS configuration
  • Install the .NET Core Windows Server Hosting bundle
  • Application configuration
  • Deploy the application
  • Configure the website in IIS
  • Create a Data Protection Registry Hive
  • Configuration of sub-applications
  • Common errors
  • Additional resources

Supported operating systems¶

The following operating systems are supported:

  • Windows 7 and newer
  • Windows Server 2008 R2 and newer*

*Conceptually, the IIS configuration described in this document also applies to hosting ASP.NET Core applications on Nano Server IIS, but refer to ASP.NET Core on Nano Server for specific instructions.

IIS configuration¶

Enable the Web Server (IIS) server role and establish role services.

Windows desktop operating systems¶

Navigate to Control Panel > Programs > Programs and Features > Turn Windows features on or off (left side of the screen). Open the group for Internet Information Services and Web Management Tools. Check the box for IIS Management Console. Check the box for World Wide Web Services. Accept the default features for World Wide Web Services or customize the IIS features to suit your needs.

../_images/wf.png

Windows Server operating systems¶

For server operating systems, use the Add Roles and Features Wizard via the Manage menu or the link in Server Manager. On the Server Roles step, check the box for Web Server (IIS).

../_images/rs.png

On the Role services step, select the IIS role services you desire or accept the default role services provided.

../_images/role-services.png

Proceed through the Confirmation step to enable the web server role and services.

Install the .NET Core Windows Server Hosting bundle¶

  1. Install the .NET Core Windows Server Hosting bundle on the server. The bundle will install the .NET Core Runtime, .NET Core Library, and the ASP.NET Core Module. The module creates the reverse-proxy between IIS and the Kestrel server.
  2. Restart the server or execute net stop was /y followed by net start w3svc from the command-line to pickup changes to the system PATH.

For more information on the ASP.NET Core Module, including configuration of the module and setting environment variables with web.config, the use of app_offline.htm to suspend request processing, and activation of module logging, see ASP.NET Core Module Configuration Reference.

Application configuration¶

Enabling the IISIntegration components¶

Include a dependency on the Microsoft.AspNetCore.Server.IISIntegration package in the application dependencies. Incorporate IIS Integration middleware into the application by adding the .UseIISIntegration() extension method to WebHostBuilder().

var host = new WebHostBuilder()
  .UseKestrel()
  .UseContentRoot(Directory.GetCurrentDirectory())
  .UseIISIntegration()
  .UseStartup<Startup>()
  .Build();

Note that code calling .UseIISIntegration() does not affect code portability.

Setting IISOptions for the IISIntegration service¶

To configure IISIntegration service options, include a service configuration for IISOptions in ConfigureServices.

services.Configure<IISOptions>(options => {
  ...
});
Option Setting
AutomaticAuthentication

If true, the authentication middleware will alter the request

user arriving and respond to generic challenges. If false,

the authentication middleware will only provide identity and

respond to challenges when explicitly indicated by the

AuthenticationScheme.

ForwardClientCertificate

If true and the MS-ASPNETCORE-CLIENTCERT request header is

present, the ITLSConnectionFeature will be populated.

ForwardWindowsAuthentication

If true, authentication middleware will attempt to authenticate

using platform handler windows authentication. If false,

authentication middleware won’t be added.

Deploy the application¶

  1. On the target IIS server, create a folder to contain the application’s published folders and files, which are described in Directory Structure.
  2. Within the folder you created, create a logs folder to hold application logs (if you plan to enable logging). If you plan to deploy your application with a logs folder in the payload, you may skip this step.
  3. Deploy the application to the folder you created on the target IIS server. MSDeploy (Web Deploy) is the recommended mechanism for deployment, but you may use any of several methods to move the application to the server (for example, Xcopy, Robocopy, or PowerShell). Visual Studio users may use the default Visual Studio web publish script. For information on using Web Deploy, see Publishing to IIS with Web Deploy using Visual Studio.

Warning

.NET Core applications are hosted via a reverse-proxy between IIS and the Kestrel server. In order to create the reverse-proxy, the web.config file must be present at the content root path (typically the app base path) of the deployed application, which is the website physical path provided to IIS.

Sensitive files exist on the app’s physical path, including subfolders, such as my_application.runtimeconfig.json, my_application.xml (XML Documentation comments), and my_application.deps.json. The web.config file is required to create the reverse proxy to Kestrel, which prevents IIS from serving these and other sensitive files. Therefore, it is important that the web.config file is never accidently renamed or removed from the deployment.

Configure the website in IIS¶

  1. In IIS Manager, create a new website. Provide a Site name and set the Physical path to the application’s assets folder that you created. Provide the Binding configuration and create the website.
  2. Set the application pool to No Managed Code. ASP.NET Core runs in a separate process and manages the runtime.

Note

If you change the default identity of the application pool from ApplicationPoolIdentity, verify the new identity has the required permissions to access the application’s assets and database.

Open the Add Website window.

../_images/addwebsitecontextmenu.png

Configure the website.

../_images/addwebsite.png

In the Application Pools panel, open the Edit Application Pool window by right-clicking on the website’s application pool and selecting Basic Settings… from the popup menu.

../_images/apppoolsbasicsettingscontextmenu.png

Set the .NET CLR version to No Managed Code.

../_images/editapppool.png

Browse the website.

../_images/browsewebsite.png

Create a Data Protection Registry Hive¶

Data Protection keys used by ASP.NET applications are stored in registry hives external to the applications. To persist the keys for a given application, you must create a registry hive for the application’s application pool.

For standalone IIS installations, you may use the Data Protection Provision-AutoGenKeys.ps1 PowerShell script for each application pool used with an ASP.NET Core application. The keys will be persisted in the registry.

In web farm scenarios, an application can be configured to use a UNC path to store its data protection key ring. By default, the data protection keys are not encrypted. You can deploy an x509 certificate to each machine to encrypt the key ring. See Configuring Data Protection for details.

Warning

Data Protection is used by various ASP.NET middlewares, including those used in authentication. Even if you do not specifically call any Data Protection APIs from your own code you should configure Data Protection with the deployment script or in your own code. If you do not configure data protection when using IIS by default the keys will be held in memory and discarded when your application closes or restarts. This will then, for example, invalidate any cookies written by the cookie authentication and users will have to login again.

Configuration of sub-applications¶

When adding applications to an IIS Site’s root application, the root application web.config file should include the <handlers> section, which adds the ASP.NET Core Module as a handler for the app. Applications added to the root application shouldn’t include the <handlers> section. If you repeat the <handlers> section in a sub-application’s web.config file, you will receive a 500.19 (Internal Server Error) referencing the faulty config file when you attempt to browse the sub-application.

Common errors¶

The following is not a complete list of errors. Should you encounter an error not listed here, please leave a detailed error message in the DISQUS section below (click Show comments to open the DISQUS panel).

To diagnose problems with IIS deployments, study browser output, examine the server’s Application log through Event Viewer, and enable module logging. The ASP.NET Core Module log will be found on the path provided in the stdoutLogFile attribute of the <aspNetCore> element in web.config. Any folders on the path provided in the attribute value must exist in the deployment. You must also set stdoutLogEnabled=”true” to enable module logging. Applications that use the publish-iis tooling to create the web.config file will default the stdoutLogEnabled setting to false, so you must manually provide the file or modify the file in order to enable module logging.

Several of the common errors do not appear in the browser, Application Log, and ASP.NET Core Module Log until the module startupTimeLimit (default: 120 seconds) and startupRetryCount (default: 2) have passed. Therefore, wait a full six minutes before deducing that the module has failed to start a process for the application.

A quick way to determine if the application is working properly is to run the application directly on Kestrel. If the application was published as a portable app, execute dotnet <my_app>.dll in the deployment folder. If the application was published as a self-contained app, run the application’s executable directly on the command line, <my_app>.exe, in the deployment folder. If Kestrel is listening on default port 5000, you should be able to browse the application at http://localhost:5000/. If the application responds normally at the Kestrel endpoint address, the problem is more likely related to the IIS-ASP.NET Core Module-Kestrel configuration and less likely within the application itself.

A way to determine if the IIS reverse proxy to the Kestrel server is working properly is to perform a simple static file request for a stylesheet, script, or image from the application’s static assets in wwwroot using Static File middleware. If the application can serve static files but MVC Views and other endpoints are failing, the problem is less likely related to the IIS-ASP.NET Core Module-Kestrel configuration and more likely within the application itself (for example, MVC routing or 500 Internal Server Error).

In most cases, enabling application logging will assist in troubleshooting problems with application or the reverse proxy. See Logging for more information.

Common errors and general troubleshooting instructions:

Installer unable to obtain VC++ Redistributable¶

  • Installer Exception: Installation of the .NET Core Windows Server Hosting Bundle fails with 0x80070002 — The system cannot find the file specified.

Troubleshooting:

  • If the server does not have Internet access while installing the server hosting bundle, this exception will ensue when the installer is prevented from obtaining the Microsoft Visual C++ 2015 Redistributable (x64) packages online. You may obtain an installer for the packages from the Microsoft Download Center.

Platform conflicts with RID¶

  • Browser: HTTP Error 502.5 — Process Failure
  • Application Log:
    — Application Error: Faulting module: KERNELBASE.dll Exception code: 0xe0434352 Faulting module path: C:WINDOWSsystem32KERNELBASE.dll
    — IIS AspNetCore Module: Failed to start process with commandline ‘“dotnet” .my_application.dll’ (portable app) or ‘“PATHmy_application.exe”’ (self-contained app), ErrorCode = ‘0x80004005’.
  • ASP.NET Core Module Log: Unhandled Exception: System.BadImageFormatException: Could not load file or assembly ‘teststandalone.dll’ or one of its dependencies. An attempt was made to load a program with an incorrect format.

Troubleshooting:

  • If you published a self-contained application, confirm that you didn’t set a platform in buildOptions of project.json that conflicts with the publishing RID. For example, do not specify a platform of x86 and publish with an RID of win81-x64 (dotnet publish -c Release -r win81-x64). The project will publish without warning or error but fail with the above logged exceptions on the server.

URI endpoint wrong or stopped website¶

  • Browser: ERR_CONNECTION_REFUSED
  • Application Log: No entry
  • ASP.NET Core Module Log: Log file not created

Troubleshooting:

  • Confirm you are using the correct URI endpoint for the application. Check your bindings.
  • Confirm that the IIS website is not in the Stopped state.

CoreWebEngine or W3SVC server features disabled¶

  • OS Exception: The IIS 7.0 CoreWebEngine and W3SVC features must be installed to use the Microsoft HTTP Platform Handler 1.x.

Troubleshooting:

  • Confirm that you have enabled the proper server role and features. See IIS Configuration.

Incorrect website physical path or application missing¶

  • Browser: 403 Forbidden: Access is denied –OR– 403.14 Forbidden: The Web server is configured to not list the contents of this directory.
  • Application Log: No entry
  • ASP.NET Core Module Log: Log file not created

Troubleshooting:

  • Check the IIS website Basic Settings and the physical application assets folder. Confirm that the application is in the folder at the IIS website Physical path.

Incorrect server role, module not installed, or incorrect permissions¶

  • Browser: 500.19 Internal Server Error: The requested page cannot be accessed because the related configuration data for the page is invalid.
  • Application Log: No entry
  • ASP.NET Core Module Log: Log file not created

Troubleshooting:

  • Confirm that you have enabled the proper server role. See IIS Configuration.
  • Check Programs & Features and confirm that the Microsoft ASP.NET Core Module has been installed. If the Microsoft ASP.NET Core Module is not present in the list of installed programs, install the module. See IIS Configuration.
  • Make sure that the Application Pool Process Model Identity is either set to ApplicationPoolIdentity; or if a custom identity is in use, confirm the identity has the correct permissions to access the application’s assets folder.

Hosting bundle not installed or server not restarted¶

  • Browser: 502.3 Bad Gateway: There was a connection error while trying to route the request.
  • Application Log: Process ‘0’ failed to start. Port = PORT, Error Code = ‘-2147024894’.
  • ASP.NET Core Module Log: Log file created but empty

Troubleshooting:

  • You may have deployed a portable application without installing .NET Core on the server. If you are attempting to deploy a portable application and have not installed .NET Core, run the .NET Core Windows Server Hosting Bundle Installer on the server. See Install the .NET Core Windows Server Hosting Bundle.
  • You may have deployed a portable application and installed .NET Core without restarting IIS. Either restart the server or restart IIS by executing net stop was /y followed by net start w3svc from the command-line.

Incorrect processPath, missing PATH variable, or dotnet.exe access violation¶

  • Browser: HTTP Error 502.5 — Process Failure
  • Application Log: Failed to start process with commandline ‘“dotnet” .my_application.dll’ (portable app) or ‘”.my_application_Foo.exe”’ (self-contained app), ErrorCode = ‘0x80070002’.
  • ASP.NET Core Module Log: Log file created but empty

Troubleshooting:

  • Check the processPath attribute on the <aspNetCore> element in web.config to confirm that it is dotnet for a portable application or .my_application.exe for a self-contained application.
  • For a portable application, dotnet.exe might not be accessible via the PATH settings. Confirm that C:Program Filesdotnet exists in the System PATH settings.
  • For a portable application, dotnet.exe might not be accessible for the user identity of the Application Pool. Confirm that the AppPool user identity has access to the C:Program Filesdotnet directory.
  • You may have deployed a portable application and installed .NET Core without restarting IIS. Either restart the server or restart IIS by executing net stop was /y followed by net start w3svc from the command-line.

Incorrect arguments of <aspNetCore> element¶

  • Browser: HTTP Error 502.5 — Process Failure
  • Application Log: Failed to start process with commandline ‘“dotnet” .my_application_Foo.dll’, ErrorCode = ‘0x80004005’.
  • ASP.NET Core Module Log: The application to execute does not exist: ‘PATHmy_application_Foo.dll’

Troubleshooting:

  • Examine the arguments attribute on the <aspNetCore> element in web.config to confirm that it is either (a) .my_applciation.dll for a portable application; or (b) not present, an empty string (arguments=”“), or a list of your application’s arguments (arguments=”arg1, arg2, …”) for a self-contained application.

Missing .NET Framework version¶

  • Browser: 502.3 Bad Gateway: There was a connection error while trying to route the request.
  • Application Log: Failed to start process with commandline ‘[IIS_WEBSITE_PHYSICAL_PATH] ‘, Error Code = ‘0x80004005’.
  • ASP.NET Core Module Log: Missing method, file, or assembly exception. The method, file, or assembly specified in the exception is a .NET Framework method, file, or assembly.

Troubleshooting:

  • Install the .NET Framework version missing from the server.

Stopped Application Pool¶

  • Browser: 503 Service Unavailable
  • Application Log: No entry
  • ASP.NET Core Module Log: Log file not created

Troubleshooting

  • Confirm that the Application Pool is not in the Stopped state.

IIS Integration middleware not implemented or .UseUrls() after .UseIISIntegration()

  • Browser: HTTP Error 502.5 — Process Failure
  • Application Log: Process was created with commandline ‘“dotnet” .my_application.dll’ (portable app) or ‘”.my_application.exe”’ (self-contained app) but either crashed or did not reponse within given time or did not listen on the given port ‘PORT’, ErrorCode = ‘0x800705b4’
  • ASP.NET Core Module Log: Log file created and shows normal operation.

Troubleshooting

  • Confirm that you have correctly referenced the IIS Integration middleware by calling the .UseIISIntegration() method of the application’s WebHostBuilder().
  • If you are using the .UseUrls() extension method when self-hosting with Kestrel, confirm that it is positioned before the .UseIISIntegration() extension method on WebHostBuilder(). .UseIISIntegration() must set the Url for the reverse-proxy when running Kestrel behind IIS and not have its value overridden by .UseUrls().

Sub-application includes a <handlers> section¶

  • Browser: HTTP Error 500.19 — Internal Server Error
  • Application Log: No entry
  • ASP.NET Core Module Log: Log file created and shows normal operation for the root application. Log file not created for the sub-application.

Troubleshooting

  • Confirm that the sub-application’s web.config file doesn’t include a <handlers> section.

Понравилась статья? Поделить с друзьями:
  • Asp net machine account что это windows 10
  • Asrock k10n78d драйвера windows 10 звук скачать
  • Asrock j3355b itx установка windows 10
  • Asrock j3355b itx драйвера windows 7
  • Asrock h81 pro btc установка windows с флешки