'CS0234:The type or namespace 'Internal' does not exist in the namespace 'Microsoft.AspnetCore.Http'. Are you missing an assembly reference?

I get this error while migrating from .netcore2.2 to 3.0 .I have replaced request.EnableRewind() with request.EnableBuffering and the code does not use Http.Internal.DefaultHttpRequest(ASP.net migration from 2.2 to 3.1). Are there any changes to be made for HttpRequest or HttpContext in the 3.0 version? Any help would be appreciated -Thanks!



Solution 1:[1]

You can refer to "Pubternal" APIs removed in the official doc,and you can see

To better maintain the public API surface of ASP.NET Core, most of the types in *.Internal namespaces (referred to as "pubternal" APIs) have become truly internal. Members in these namespaces were never meant to be supported as public-facing APIs. The APIs could break in minor releases and often did. Code that depends on these APIs breaks when updating to ASP.NET Core 3.0.

If you are using HttpContext.Request.EnableRewind();,try to use HttpContext.Request.EnableBuffering(); to replace it.

In an ASP.NET Core 3.0 project, replace the EnableRewind call with a call to the EnableBuffering extension method. The request buffering feature works as it did in the past. EnableBuffering calls the now internal API.

Solution 2:[2]

Try adding <FrameworkReference Include="Microsoft.AspNetCore.App" /> in your .csproject and see that if it resolves.

You can find more details related to this issue here.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Yiyi You
Solution 2 fingers10