Migrating a console application to net core - .net-core

One of my Client wants to migrate a console app (having System.Web dlls) to .Net Core. Do we have any relevant mapping tool which shows corresponding methods of System.Web to .Net Core.
Currently .Net portability analyzer only provides a compatibility report showing whether app can be ported or not, for relevant corresponding method mappings etc. client has to use MS docs and then do relevant method calls for .net core.
Any suggestions or recommendations or any tool which can provide relevant method replacements or make migration easier?.
Thanks In Advance!!!..

Related

Migrating from NET4.8 to NET5/Core, is Full Framework required?

Using the NET Upgrade Assistant, it informed me that it couldn't perform the migration since the code was not in .NET Full Framework. For code to operate in the new NET world, is that a requirement or is that a assistant issue? Can I just create a new project and manually move everything to it?
The error is
[09:22:29 ERR] Support for Web Forms is limited to .NET Full Framework. To learn more please read: aka.ms/migrate-web-forms [09:22:29 ERR] Project C:\Projects\IC\VS2022\SentryServices_NET5_Dev\WWW\www.csproj uses feature(s) that are not supported.
Well, web forms is so old, it's no longer supported in .NET Core or .NET 5.
You can read the link the error message gave you, to find out what you can do about that.
You will have to rewrite considerable parts of your app. While it is possible to just copy over source code files, that only works if the code written would work under .NET 5. If it wouldn't, like web forms, then there is no real migration path other than rewrite it.

.NET framework or .NET Core for Web API for legacy SQL Server database

I am working on my first .NET Web API. I have an existing .NET Windows Forms application using a SQL Server 2008 R2 database, and now I need to write a new app: a straightforward Android tablet application that will access the same database. These apps for just for internal use; not outside the one company.
I have been on a long journey though many tutorials, blogs and posts here, including this I'm lost. What happened to ASP.NET MVC 5? super helpful explanation of .net products and versions. But over and over I get hopelessly confused about which product I should choose to write the Web API. I can't always tell from some of the tutorials whether the ideas and techniques and configurations apply to both .NET Core and .NET Framework, or just one, and if the tutorial works with current versions. I am using Visual Studio 2019.
Does anyone have a recommendation for whether I should be using .NET Framework 4.8, or the new .NET Core?
I do not find this guidance from Microsoft helpful.
I think I should probably use Entity Framework to generate code from my existing database, but I also think I could pretty quickly code SQL calls right into the Web API controllers as I have seen done in some tutorials. Is that considered a bad practice?
Thank you for any steering you might offer.

Service Fabric V2 remoting Custom Headers

I am using Service Fabric with .net core with Service Fabric Remoting V2. and I am building a multi-tenant app and I want to add custom header to send the tenant ID automatically.
I have started with the solution for this question which uses normal .net framework with service fabric but in the case of .net core it didn't even compile since the service fabric with .net core has different APIs and Methods.
The code goes as follows and There are many cases for non existing APIs:
The Client
ProxyFactory
var _proxyFactory =
new ServiceProxyFactory(c => new ServiceRemotingClientFactoryWrapper(new WcfServiceRemotingClientFactory(callbackClient: c)));
The bold class comes from the Microsoft.ServiceFabric.Services.Wcf package (aside whats said in the nuget site) it is asking me to add a System.ServiceModel Dll which is a full .net library and not even in the stated dependencies.
The ServiceRemotingClientWrapper provided in the solution contains a class named ServiceRemotingMessageHeaders which according to documentation is the in the service remoting class but it doesn't exist.
Also the functions in the interface take IServiceRemotingRequestMessage which is different from the aforementioned demo.
The Server
the class ServiceRemotingDispatcher should be in the remoting Dll and yet it doesn't exit.
Finally, This project uses the same methodology to implement my goal and its based on the same SOF question but uses full .net framework and it works. Link to project

Pipeline Development with ASP.NET

Microsoft offers Pipeline Development via its Extensibility framework where the application can consume External Addins. I have successfully developed an extensible application on a Windows Console Project.
Now I need to implement an extensible website which accepts Addins, I googled for days for guidelines to do so, unfortunately I couldn't find any resources.
So, my question: is it possible to do that ? if yes can you provide any resources to learn from ?
I found out that you can't use M.A.F with Asp.Net because the Grabdge Collection will be very ugly.
Instead if someone ever will counterpart this question, The answer is:
You will need to use M.E.F (Managed Extensibility Framework) which comes as part of .Net 4.0+

How to explain Katana and OWIN in simple words and uses?

I have read many articles about the OWIN and Katana projects, but I could not get the whole picture of it.
For a normal web developer who uses ASP.NET:
What exactly is OWIN and what problems does it solve (in simple words). What is its relation to IIS?
Does OWIN replace IIS? if not, in what situations does OWIN best fit?
How could OWIN help me in my daily work projects?
How could OWIN help me in a self-improvement projects?
Regarding the comment above, OWIN is not a framework. OWIN is a specification on how web servers and web applications should be built in order to decouple them and allow movement of ASP.NET applications to environments which were not supported before.
Prior to OWIN, when building ASP.NET application, you were inherently bound to IIS due to the heavy dependency on System.Web assembly.
System.Web is something that has existed ever since ASP (non .NET version) and internally contains many things that you might not even need (such as Web Forms or URL Authorization), which by default all run on every request, thus consuming resources and making ASP.NET applications in general lot slower than its counterparts such as Node.js for example.
OWIN itself does not have any tools, libraries or anything else. It is just a specification.
Katana on the other hand, is a fully developed framework made to make a bridge between current ASP.NET frameworks and OWIN specification. At the moment, Katana has successfully adapted the following ASP.NET frameworks to OWIN:
Web API
Signal R
ASP.NET MVC and Web Forms are still running exclusively via System.Web, and in the long run there is a plan to decouple those as well.
On the other hand, IIS is a good, resourceful host for web servers. Entire ASP.NET performance issues using IIS has deep roots in System.Web only. Up until the recent time, when deciding how will you host your web server, you had two options:
IIS
Self-Host
So if you wanted a performance, you'd go for a self-host option. If you wanted a lot of out-of-the-box features that IIS provides, you'd go for IIS but you'd lose on performance.
Now, there is a 3rd option, a Microsoft library named Helios (current codename) which intends to remove System.Web out of the way, and allow you to use IIS on more "cleaner" way, without any unnecessary libraries or modules. Helios is now in pre-release version, and is waiting for more community feedback in order to make it fully supported Microsoft product.
Hope this explanation clarifies things better for you.
EDIT (Sep 2014):
With ASP.NET vNext being in development, Katana is slowly getting retired. Version 3.0 will most likely be last major release of Katana as a standalone framework.
However, all the concepts introduced with Katana are being integrated into ASP.NET vNext, meaning that programming model will be pretty much the same. Quote from forum post made by David Fowler (Architect of ASP.NET vNext):
vNext is the successor to Katana (which is why they look so similar).
Katana was the beginning of the break away from System.Web and to more
modular components for the web stack. You can see vNext as a
continuation of that work but going much further (new CLR, new Project
System, new http abstractions).
Everything that exists today in Katana will make it's way into vNext.
EDIT (Feb 2015):
ASP.NET vNext is now known as ASP.NET 5 and will be built on top of .NET Core 5. .NET Core 5 is lightweight factored version of .NET Framework, designed to support goals of ASP.NET 5 and .NET Native. However, ASP.NET 5 will be supported by .NET Framework 4.6 as well, that should become available together with .NET Core 5. Both ASP.NET 5 and .NET Core 5 will be licensed under MIT and will accept community contributions.
EDIT (May 2015):
Additionally, ASP.NET Web API brand will be discontinued, however it's technology will be base for new ASP.NET MVC 6. Previous ASP.NET MVC versions were built by implementing IHttpHandler, an interface defined in System.Web. ASP.NET MVC 6 removes that dependency, making it portable to various platforms and web servers.
EDIT (May 2016):
ASP.NET 5 will officially be renamed to ASP.NET Core starting with Release Candidate 2 that is scheduled to be released soon. Same will apply for Entity Framework 7 which will be renamed to Entity Framework Core. More information about official announcement and reasons behind it can be found on Scott Hanselman's blog post:
ASP.NET 5 is dead - Introducing ASP.NET Core 1.0 and .NET Core 1.0
EDIT (May 2016):
With the release of Release Candidate 2, ASP.NET Core has been modified so that future web apps are actually just .NET Core console apps setup to process incoming HTTP requests. This concept makes ASP.NET Core even more aligned with approach Microsoft has taken with microservices architecture support and its implementation through Azure Service Fabric. More information on can be found on official blog post:
Announcing ASP.NET Core RC2
If I have to define OWIN for myself, that would be: "The best ideas from the Ruby and Node.js web dev communities, coming to .NET"
But this would not help any ASP.NET developer. My own definition would be something along the lines of:
OWIN defines a standard interface between .NET web servers and web applications. The goal of the OWIN interface is to decouple server and application
If I have to answer the questions you've posed, then here it is:
OWIN is an interface specification. It decouples a web applications from IIS.
If you are using ready-made components (which is what Katana is), then some parts of the application functionality are much easier to implement compared compared to old ASP.NET. Authentication with third-party identity providers (Facebook, Twitter) is one example of this.
OWIN is essentially a collection of best practices, which have been proven in web development communities. It shows a way to implement web apps which is very open to extensibility. As each web developer should constantly be on the cutting edge of new technologies, this is one way to stay up to date with the whole web development community and not just .NET. If you learn OWIN, it would be much easier to learn other web development frameworks like Express for node.js or Rack for Ruby, because the practices they use are similar.
I will try to cover it from the practical perspective.
Katana is project name to implement OWIN in Microsoft.
What exactly is OWIN and what problems does it solve (in simple words). What is its relation to IIS?
OWIN (Open Web Interface for .NET) is a standard (OWIN Specification) and Katana is .NET library, you can get nuget from here. OWIN and Katana became somewhat synonymous on the web.
Before OWIN your only option was IIS with OWIN you can use any other application (that has entry point) as web server.
Does OWIN replace IIS? if not, in what situations does OWIN best fit?
No it does not replace IIS, you can use OWIN and IIS there's Microsoft.Owin.Host.SystemWeb nuget for that. It is best fit if you want to optimise/change the way it is handled in IIS, or you want to create your custom web server out of let's say Windows Forms Application.
How could OWIN help me in my daily work projects?
It could reduce your server running costs since your web servers do not need to run on IIS (Windows) anymore (Windows servers are more expensive than Unix based ones, and you could run it on Console Application under Mono in Linux).
How could OWIN help me in a self-improvement projects?
Learning Microsoft.Owin (and other related OWIN libraries) will improve your knowledge on how HTTP communication between client and web server works.
Good read if you want to understand more on what Katana and OWIN is.
What is OWIN?
OWIN stands for Open Web Interface for .NET. OWIN is a specification that describes how web development frameworks such as ASP.NET MVC should interact with the web servers. The goal of OWIN is to decouple web applications from the web server by introducing an abstraction layer. Such an abstraction enables you to run the same application on all the web servers that support OWIN. Additionally, it simplifies the overall system because the abstraction layer can provide a lightweight infrastructure to host the applications. IIS provides a rich set of features to the web applications. However, web applications may not need all these features. It might be sufficient for them to have minimal HTTP processing capabilities. OWIN compatible host can provide such a hosting environment to these applications. Moreover, you can define a pipeline of modules that are used during the request processing. An OWIN pipeline is a chain of OWIN compatible components through which a request passes.
What is Katana?
Katana is a set of components by Microsoft built using OWIN specifications. Some of these components include Web API, ASP.NET Identity and SignalR.
Above is extract from CodeGuru Article : http://www.codeguru.com/csharp/.net/net_asp/overview-of-owin-and-katana.htm

Resources