This is a migrated thread and some comments may be shown as answers.

.NET 2.1 template does not work

1 Answer 25 Views
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Matthew asked on 31 May 2018, 01:05 PM

ASP.NET Core 2018.2.516

Grid and menu

IIS Express

HTTP Error when I run.

 

Anyone else ? 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 05 Jun 2018, 09:58 AM
Hello Matthew,

ASP.NET Core 2.1 was officially released on May 30, 2018, while Telerik UI for ASP.NET Core R2 2018 was released earlier - on May 16, 2018. Our R2 2018 templates are targeting 'Microsoft.AspNetCore.All', version '2.1.0-preview1-final', which was available at the time we prepared this release.

Currently all Telerik UI for ASP.NET Core templates configured for ASP.NET Core 2.1 will face "HTTP Error 502.5 - Process Failure" error, when run on a machine with the official ASP.NET Core 2.1 release version. In order to extract more meaningful description of the issue, we should change the stdoutLogEnabled key in project's web.config to true and create a logs folder at project's root level:

<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"/>

Then when we run the application again, a log file will be generated in logs folder, telling us what is the actual issue. In this case the error log reads:

It was not possible to find any compatible framework version
The specified framework 'Microsoft.AspNetCore.All', version '2.1.0-preview1-final' was not found.
  - Check application dependencies and target a framework version installed at:
      C:\Program Files\dotnet\
  - Installing .NET Core prerequisites might help resolve this problem:
  - The .NET Core framework and SDK can be installed from:
  - The following versions are installed:
      2.1.0 at [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]

Following the article Migrate from ASP.NET Core 2.0 to 2.1 we have fixed the issue by changing template projects configurations to match the setup required by the official ASP.NET Core 2.1 version. The fixed templates will be available in R2 2018 SP1 release in a couple of weeks. While part of the steps were already implemented as part of migrating from 2.0 to 2.1 preview, there are still some changes needed between 2.1 preview and 2.1 official.

Workaround: In order to fix this template and the rest of the templates, here are the changes required:

1. For TargetFramework ASP.NET Core projects - in .csproj file:
  - Replace the Microsoft.AspNetCore.All reference with Microsoft.AspNetCore.App:
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.0-preview1-final" />
<PackageReference Include="Microsoft.AspNetCore.App" />

  - Remove DotNetCliToolReference:
<ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.1.0-preview1-final" />
</ItemGroup>

2. For TargetFramework .NET Framework projects - in .csproj file:

  - Change all references for version 2.1.0-preview1-final to version 2.1.0

  - Remove DotNetCliToolReference:
<ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.1.0-preview1-final" />
</ItemGroup>

3. For both TargetFrameworks - in Startup.cs file:

  - Add the following usings:
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

  - Add CompatibilityVersion line:
// Add framework services.
services
   .AddMvc()
   .SetCompatibilityVersion(CompatibilityVersion.Version_2_1)

  - Remove app.UseBrowserLink() line:
if (env.IsDevelopment())
{
    app.UseDeveloperExceptionPage();
    app.UseBrowserLink();
}

So editing these two files to target ASP.NET Core 2.1 official references will fix the issue and templates will run as expected.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Asked by
Matthew
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or