5

when i migrate from .netframework to .net core than I get this error in .netcore 3.1 i follow this link here here but still not able to resolve this issue .

 public static void Register(HttpConfiguration config)
        {
            config.MapHttpAttributeRoutes();

            // Web API configuration and services
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}"
            );

            config.Routes.MapHttpRoute(
                name: "DefaultApiWithActionApi",
                routeTemplate: "api/{controller}/{action}"
            );

            // Configure formatting settings
            ConfigureFormatting(config);

            // Add Global Exception Handling and Logging
            config.Services.Replace(typeof(IExceptionHandler), GlobalExceptionHandler.GetInstance());
            config.Services.Replace(typeof(IExceptionLogger), new GlobalExceptionLogger());
        }

Severity Code Description Project File Line Suppression State Error CS7069 Reference to type 'Route' claims it is defined in 'System.Web', but it could not be found WorkerRole

is their alternet so on change it remove my error it work similar .

any suggestion is accepted.

1 Answers1

0

It looks like a config file in the .NET framework, To achieve this in .NET core 3.1 you should add your configuration in a startup.cs file for .net core.

e.g In configure method of startup.cs file

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseRouting();
            // global cors policy
            app.UseCors(x => x
                .AllowAnyOrigin()
                .AllowAnyMethod()
                .AllowAnyHeader());
            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Rohit Jadhav
  • 1,035
  • 2
  • 11
  • 14