AWS Nordics Office Hours - Modernizing legacy WCF applications to CoreWCF

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone and welcome to the aws nordic's office hours with me giona i'm a developer advocate here at aws and this is our weekly show where i bring on guests to talk about a specific topic and let you our viewers ask your questions and uh get any questions you'd like answered by me and my guest and this week i'm joined by prasad rao and welcome to the show prasad thank you so this week we're going to talk about modernizing legacy wcf applications to core wcf using portingassistant4.net and there's a lot to cover in in that title only so prasad to begin with tell everyone a bit about yourself sure so i'm a partner solution architect here at aws uh with aws around two years now and like yeah i specialize in migrating and modernizing microsoft workloads onto aws so welcome to the show then and uh well let's jump back to that title or what we're going to talk about that i mentioned and i think we need to cover what all of those things are right so first off uh when we're talking about legacy wcf applications what are those so yeah even before understanding wcf applications let's talk about you know like the legacy.net applications so wcf applications are a specific type of dotnet applications so let us first talk a bit about the dotnet framework applications so dotnet framework it all started in 2002 when microsoft released the first version of net framework and they kept enhancing it you know with multiple releases over a decade and till 2012 uh they kept releasing multiple versions for dotnet framework it was one of the widely used you know like a framework for developers developing applications on windows platform so dotnet framework was proprietary and it was only working on windows platform in 2012 uh microsoft thought uh that they should invest more in open source and then they started working on open source cross platform version of dotnet which they call it as.net core and that was released in 2016. so first release of net core was released in 2016 and from that it enabled the you know like developers to develop applications uh you know like uh i in you know like dotnet but deploy it and run it on linux platform or other platforms and it is open source so we have a dotnet foundation which is an open source community and developers are able to contribute to it so yeah that's about the history of you know that dot net yeah and uh i i mentioned to you before we we when we talked about this topic that fees like two 2012 uh just feels like a few years ago for me that dot dot net framework was a thing but uh net core then has been the the option for developers using.net now for quite a few years yes and microsoft is you know like and you know overall open source communities is you know like enhancing it uh quite you know like a lot so we had net core 3.0 released in 2019 around and after that uh microsoft thought you know like it is time to almost retire.net framework so they released just one minor version for net framework which is.net framework 4.8 and now everything going ahead will be only on the dotnet and now they have unified it and they call it as dot net and not a framework or not a core so they now call it a normal.net and which is going to be an open source cloud platform and the release.net 5 last year at 2020 but it is not a long term version release so they are releasing dot net six uh which is which is going to be the long term version so yeah all enhancements would be going you know forward will be on.net and that is why it is interesting for our customers right most of the enterprise customers do have a lot of you know net framework legacy applications you know i have built quite a lot of dotnet framework applications for like you know financial customers before joining aws and now this is the opportunity for customers to modernize them onto the newer version of dotnet and potentially save a lot of cost by you know like running them on linux platform right so you know yeah performance wise it is better you can use the you know like ecosystem of the entire linux and from the cost perspective you are going away from the windows server licenses what are the customers uh tip the typical customer using um dotnet applications is it enterprises or do you see it across uh different verticals and different type of companies now you know like i i see whenever it opted initially microsoft has good penetration into enterprises right so that is why you know it was you know like mostly rocketed by enterprises initially but now i see dotnet is being used widely across you know like even the startups to mid-size companies they use a.net quite uh widely and you know like yeah there are case studies in which uh customers have actually in like modernize their dot net framework applications to net core and run on aws using no containers you know like um and cloud native uh alternatives right so then um well let's get to what we're actually gonna do in this episode with when we've covered a bit of the the context so what are the ways to then modernize your applications so okay so when you have a dotnet framework applications it depends upon your application to application uh you have several ways to modernize them right uh if you talk about when you know applications were developed a decade ago there was more more of a monolithic constructs right you know a lot of the applications which are developed were monolithic now while modernizing them are you not only you know like port them from dotnet framework to net core but also try and deconstruct that monolith into micro services and have these multiple uh net core or you know like dot net five micro services which can run independently and we we all know the benefits of you know like having micro services architecture over the monolithic that in terms of you know the elasticity scalability and independent you know like without the tight coupling that it provides so that's where i see you know like the you know most of the industry moving towards that they are modernizing their monolithic applications to the micro services and try and run them on more cloud native toolings whether it is serverless on lambda or having the you know containerize them and running on ecs or eks so um then we get to what is called porting assistant porting assistant for net so tell us a bit about that sure so when we talk about you know like you know as i said you know like microsoft last you know major release for net framework was in 2012 and then they you know like took three or four years to release.net core which is open source version now customers when they would like to port their.net framework applications to dotnet you know like core the problem with it is that not all apis or the nuget packages which are core4the.net are compatible with dotnet core it means that there are you know like packages which were tightly bound to the windows platform and you will not be able to use them as it is in the open source version right and that is why the overall porting a.net framework application.net core is hard and this is where you know like the customers are investing a lot of time and that's when you know like we at aws thought about you know how we can make this overall journey simpler for our customers right we understand that the customers want to modernize their legacy applications onto aws using cloud native elect tooling but you know we would like to like reduce the overall you know like resistance that customers had that this hole will require a lot of you know like uh effort from their side and that's when we released a portingassistant4.net which is a way to assess your current.net framework application so yeah if you'd like to share the screen probably i can you know start showing the overall tool along with it so yeah this is like votingassistanfor.net or before that let me go on to the home page for portingassistantfor.net yeah so this is the porting assist assistantfor.net homepage and we released it in july uh last year the first version which actually allows you know like customers to assess their existing dotnet framework applications and you know like see how much effort would would be requiring for you know like a porting it to net core and then later in the year we also introduced something called a cta which is code translation feature in which we have tried to find the common patterns in the dotnet framework applications and i've written rules which will help them to make those code changes automatically so mainly you know if we see from the benefits perspective uh it first of all you know like because we are able to assess uh the overall so let's say for application and we look into that you know during the uh a quick demo also let's say if our application or a solution file has 25 30 projects right it's a large application then in what you know like a phased manner you should be actually starting to modernize them right so the overall assessment helps you to see you know like what are the low hanging fruits which you can start targeting and start modernizing so you can you know create that you know understand the overall effort and create that overall plan all right and then even while porting you are able to reduce the overall manual effort because you know the voting assistant what it does is that it identifies the common patterns uh of you know like uh what a dotnet framework equivalent looks in dotnet core and it goes ahead and make those changes you know like on its own obviously you know it shows whether you would like to make the changes or you would like to you know like do it on your own and you can choose accordingly and then you know it makes the code changes on your behalf so yeah that's uh you know like the overall high level of view of putting assistant but if you would like to yeah yeah importing assistant it's a standalone application so it's not something that you're running in the console for instance as people might be used to right so porting assistant is available currently in two versions one it's a standalone application that you can install on your windows desktop and secondly you know like later in the year around november i believe last year we released you know like a visual studio plugin we needed extension for the visual studio for the developers who would like to remain in the development environment and start porting so it is available within the visual studio as well as as a standalone tool there are bit you know like features which are more available in the standalone tool and we look into that but when it comes to more developer friendly we show like all the incompatibilities in the warning sections within the visual studio itself so it depends upon you know developers how they would like to you know like uh use the whole experience of porting assistant all right so should we have a look at the application or what you want to do next yeah sure you know like yeah just before that you know before we dive deep into the application overall how it works you know this is something that we discussed briefly right now but again it all starts with you know like assessing the current uh you know like application which is you know when you um uh you know like open the cellular tool and provide it a solution file it requires a solution file to access the entire code base and it scans it through uh you know like the overall uh code file and finds the you know like uh apis and you get packages which are compatible and not compatible and shows that when the assessment is done you can always export that assessment and then you can think about you know like planning your whole uh project of how you would like you know like go on individual projects and finally i said you know we do have a option for assisted porting uh in which we use uh the feature called code translation assistance and we can dive deep into it during uh the demo but yeah as you said let's uh go to the tool right and to begin with since this is a standalone application there's one feature missing missing that we talked about before we went live yeah it's like you know we are not able to zoom it you know like uh yeah i'm not sure if how well readers are able to read this is the font size okay or not uh but yeah this is something that you know uh working with service team to have that feature uh is to have the ability to zoom it or something like that yeah but we'll we'll walk through every part and you'll explain it so yeah and they'll be able to follow along right so yeah the ui is very familiar it looks a lot like something in the aws console so that's that's good start so yeah when we first installed this is the home page that comes about you know we have this get started button here which can you know and even for downloading this let me go back here and you can download it from the home page of the putting assistant and then just install it it's just a msi which can be installed and then when you first open it this is how it looks like uh it also lists all the you know like benefits and features here um yeah which we you know like anyways discussed for the first time when you would like to assess a a particular solution uh it'll ask you to provide some mandatory settings right so let's look into that you know if i click on edit here the first is the target framework so i said dotnet a core currently so your source file would be net framework but your target can either be dotnet core or dot net five so we have two releases right now and dot net six will come later this year like you know probably around mid november dot net six would be coming then we'll be adding support for dot net six two but right now customers has options to port their.net framework application to either.net core or dotnet5 i'll keep it as dotnet core because.net core is the long term version release yes so so uh even though it's a different name it skips a bit of versions it dot net five it is the the following verse version basically and then we'll have number six which will have long term support again yes yeah that's great cool and the second is mainly this is the cli credentials that we provide you know aws named profile that we need to uh provide so i have it configured as my own you know like a cli profile and i've configured it so this is how you access the aws account it is mainly needed you know like uh for sharing uh you know a bit of the usage data and uh getting the information about all the like a common patterns which is used to analyze and assess the overall data if the customers are not you know like comfortable in you know sharing that usage information with aws they can always uncheck this cool that's on the settings part and once the settings is saved you can always go to ss solutions i already assist one particular solution knob commerce when we'll do a demo of a specific wcf application we'll go ahead and do a ss solution but first i would like to show more of the features with one of the solution that i've already assessed at so nope commerce is an open source e-commerce project actually uh it you know the latest version of knob commerce is already in a.net core but i have used a version 3.8 release of knob commerce which is in uh dot net framework five dot o so this particular when we assess it this is how you know it it shows uh the overall information right the number of ported projects so this knob commerce as a solution has 35 projects in it right and there are zero projects that are ported so while porting we do have option to put you know like all the projects at one go or you know like select few of them and project it like you know in a sequential manner [Music] the number of incompatible packages so this is where you know like overall the number of packages that are being used whenever you say packages these are new get packages that is used in the dotnet in a world so there are total 56 nougat packages that are being used across the 35 projects in the overall commerce solution out of which 52 are incompatible right so you see a lot of there's a lot of changes though it is all.net you know the the code writing style is same but the underlying packages are quite different and i i know this is a typical it depends question but is that common that you'll end up with that many incompatible patch packages it depends the answer is exactly independent right so yeah it depends on how complex this application is for example not commerce is a quite big and complex application all right so uh when we will show a demo of full end-to-end porting i'll be using a very simple basic wcf application that might be having a lower level of incompatibilities yep right then we have incompatible apis uh the ratio is a bit better like you know one three nine five apis overall uh versus 451 incompatible and those are those are apis within in this case.net framework yes that are incompatible with the newer uh net core right all right so the internal apis that are being called within these packages and the source code that are incompatible build errors this shows that in case you if your current.net framework application that you're trying to assess if it has any build errors it is going to show it there right it's not going to build it against net core yet unless we port it so right now it is not ported so it is building it against net framework version only and it has zero errors porting actions this is interesting and this is what we will dive deep into when we will do the demo of wcf application right so it shows that to resolve these errors incompatible there are overall 640 porting actions that needs to be taken either manually or it will be automated as much as it can be by putting assistant for dotnet you know that the tool so it will try and you know like automate as much as it can and when we'll see the visual studio version of it uh we'll see that there are two types of error codes p a triple zero one and p a triple zero two uh p a triple zero two means it is something that the tool can automatically update the source code pa triple zero one may mean that the you know like a manual intervention is required right right so as i said this is a complex project and it will overall require 640 porting actions so when you know like see the typical problem with the project managers or when we start with a new you know like a project of modernizing our application is that assessing that level of effort you know we cannot give an estimate like you know it will take one month with two developers or unless we have this kind of assessment up front a lot of time what happens is that we go on a guess estimate right but this gives you a accurate level of you know like uh information of okay how much effort might be required and then we drill down so i'm going to drill down into this and i'm not sure how again the font is but i'll try and explain uh each and every portion of it uh for for our viewers so now this is the overall dashboard of the knob commerce in the drill down view in which you know we can drill down and see uh the more information about uh the incompatibilities the pain points where we need to focus our efforts on and so on and so forth the first assessment overview is again this similar summary uh that is like 52 are incompatible you get packages out of 56 and this kind of bar shows that how well you are so while you start porting right if you put like let's say a few of the projects this bar is going to show an indication about you know how well are you doing or how far you are from your success similarly incompatible apis and the build errors and porting actions right for any of this information can just click here it gives you a bit of information about what exactly these are right whether reporting actions the number of putting actions in the ss solutions right now then we have multiple tabs here which shows information with different pivot angles right so first is the projects like as we said there are 35 projects so it lists all the projects so now we know that the number of incompatible packages are 52 out of 56 at a solution level but if you would like to look at the project level like for example knob.web it is using 38 packages out of which 36 are incompatible so now we are able to see at a project level the information how many projects is this particular project dependent on it is dependent on four projects so if we modernize this and the dependent projects are not modernized then it might not work right so for example knob dot core it does not reference any project so probably this might be a right candidate from where we can start the porting right and then we can start putting other projects which are dependent on these because the core module is proven so this helps in overall planning you know with the timelines okay let's start with core and let's see how how difficult uh you know like core is there so to assess the effort uh for the core right the number of incompatible packages are just seven compared to like overall 52 incompatible packages there are only seven that are here so it will be easier probably to resolve it will give the team the confidence also you know okay we are able to progress incompatible apis are 26. the number of putting actions are relatively less like eight compared to if we see knob dot web right it is 169. right so that's the level of information that we have and you know uh yeah as i said it's a standalone tool not a great you know like uh ui that we will not be able to like kind of a top entail on this but yes we can you know like always uh what you call uh salt uh stuff you know uh based on whichever uh you know like uh parameter you would like yeah so all of these are dotnet framework 4.5.1 as of now okay so that's on the projects now if we move to project references now this is a project a dependency graph right so what this helps is in visualizing all the projects and which depends on what right here we did see that with the numbers but this shows it in a better way you know like uh how would like you can always you know like look into it for example knob.core all the projects are coming into it none of the projects are going out of it for example knob data all the projects are coming into it right so you might think about you know probably knob.data is a better place to start than knob.core because there are less number of trades that are you know like are depending to it it'll depend upon the strategy which the you know like teams teams would like to take on how they would like to start right and again you can always start inside out or outside in it it totally depends upon you know like how you'd like so generally what happens is that you have a specific application and you keep developing that application though there is a parallel team which starts modernizing it but the current release keeps on going on that makes it a bit more difficult right so though knob.code is being modernized but there are more you know like features that are being added to knob.core framework version so we need to you know like balance that out so yeah this particular shows the dependency graph and this is one feature which is not available in the visual studio extension in the developer environment because that is more developer friendly and does not have this you know like a web uh gui or you know like this kind of graphs going to negate packages now we know that overall there are 56 nougat packages and a lot of them are incompatible right now it shows that each nuget package how many projects it is being used in for example in auto faq it is being used in 13 projects so if you are going to resolve this nuget package we are able to resolve issues in 13 projects for this particular package right the number of source files it is being you know like used in it is being used in 17 source files the current version is 3.5.2 of this particular package it is incompatible right but we have been able to suggest a replacement that if you upgrade autofaq to 4.0 then that will automatically become compatible so we do have a huge data store uh in our github and that is open source in which we have all these recommendations you know like inbuilt of you know like okay if depending upon what kind of you know like uh nuget packages are and you know and what version of those are compatible with net core so what happens was that you know all these nuget packages uh they were developed along with the dot net framework so the previous versions are not compatible right but when dotnet core came these nuget packages also upgraded uh to support.net core so it might be a simple uh matter of you know like upgrading of the suggested replacement all right yeah that's cool so looking at the line below for instance then autofact dot mvc5 which doesn't have a suggested replacement what does that mean instead then that means that you know this particular nuget packages cannot be upgraded to resolve the issues or even if it is there uh porting assistant does not know of it you know like if if someone knows it they can always raise a pull request and based on the information that is why you know we have this you know share the usage information and when we get this kind of information that okay you know like somewhere uh a developer has been able to upgrade this to a newer version it worked we added to our you know like uh overall data store uh but yeah at this moment it means that either this does not have a upgrade version or porting assistant is not aware of it and it means that there might be a manual action required and we'll talk about that in the source file it means that there might be an alternative that you'll have to use it's not that you know it can be a what you call automated upgrade right again similar you know stuff you know we can always uh sort it by this for example like microsoft asp.mvc it has been using 32 projects right out of the overall 35 projects 32 projects are using this particular dll and you know so on and so forth moving on to the apis now that was pivoted based on nuget packages this is based pivoted based on apis again similar information right uh that uh how many source files it is being used in how many calls it is being done like for example accept verbs uh this is part of this particular new get package there are five source files which is using it and it is being called six times and again it is incompatible right and we do not have a lot of suggested replacements for these yeah so there are few for which we have suggested replacement but quite many of them might not be having this relative replacement so for example this xml read element string right so instead of freezer element string the replacement is read element content as string so this is the new apin.net core so dotnet framework api meant read element string but now it has been renamed to read element content as string and that suggested replacement is something that you know yeah so these are compatible because just change of this which can be done automatically by the boarding assistant and you are good to go cool okay source files this is interesting it shows all the source files along with the incompatible apis all right so what i'll do is that i'll probably go with someone which has a lot of incompatible apis yeah for example paypal direct payment processor 41 incompatible apis right if i click here it shows the code right and it shows exactly that this particular method is incompatible and it cannot be invoked so it at a line level you know so in the source code it shows at the specific line number level where a manual change might be required so this helps uh developers understand okay uh that where exactly the errors exist and how they can do it is that uh accessible in the visual studio plugin exactly so this is why you know like the overall experience we thought that instead of you know like developers switching on between uh the standalone tool to find where the error is and going back to the editor and do the changes there we thought we should be having this whole experience within the uh editor itself this is editor and in the visual studio you know as generally the errors are shown right with us quickly uh behind you know beneath so that is we'll see it you know depending upon how much time we have uh in that this particular is shown there with a warning in the visual studio itself and along with the error let's go cool that's on all the kind of features i'm just looking if there is a you know like uh where uh no it's all about incompatible apis only right i'm looking if there is a example where i can show a manual an automated code change that can be done but we can see that you know like during the demo of the wcf yeah i think we are halfway into the session right so yeah a good time for us to start focusing on wcf yeah so you can start prep for that and in the meantime everyone if you just joined us this is the aws nordic's office hours with me gil narayan i'm joined by prasad today and we're looking at modernizing legacy wcf applications using portingassistantfor.net and prasad has just done a walkthrough of the porting assistant for us to look at um well an example solution that he has assessed and now it's time to uh do an assessment from from scratch and in the if you have any questions just post them in the chat and we'll do our best to answer those cool so while we start assessing wcf applications so wcf is a specific type of.net application it is windows foundation let me first browse through it okay okay so i have this folder let me what i'll do is that wcf demo i'm going to uh use us you know let me clone the project here give me just one moment i'm not sure if you mentioned that but the wcf support importing assistant that is very new right so as i said wcf is a specific kind of dotnet application when we released porting assistant we were supporting more of asp.net applications but we got the feedback from the customers that you know like uh we uh a lot of their legacy applications involved wcf uh which is a way to create applications it's a more of a remote procedure called applications uh which is you know like uh done via wcf but it is very tied to windows right so if they have a wcf application then moving them off windows is even more difficult all right so for that there is a open source uh you know like um uh initiative going on called core wcf which is you know like again by.net foundation and aws is the second highest contributor to that project after microsoft and core wcf allows you to modernize your wsf applications to uh you know like code wcf and run it on linux now porting assistant and that code wcf went to ga uh in february this year uh that was initial release and they have been enhancing so right now the released version is 0.3 we have not released we have not reached a one dot or major release yet for the wc core wcf but that's when we thought it is the right time for putting assistant to start supporting wsf application modernization to core wcf so we released it like last week so let me uh i'm just taking a sample wcf application from the microsoft github here and what i'll do is that first so there are a lot of you know like when it comes to wcf as i said it's a communication protocol right so there are different types of bindings there are different types of you know like uh security protocols that are there so we'll use a tcp instead of a you know like basic http or is so we'll use tcp here to showcase the overall uh demo so let me open it and first go through the solution for a moment and i'll run it on the dotnet framework and then we'll assess it via porting assistant let me just drag my visual studio onto the screen okay so as i said you know this simple project there are three simple solutions three projects in it the first one is a service library which is more like a definition of you know like the contracts uh let me open it and show that and let me see if i can increase the font is this better one twice yes cool so it has like two contracts get data and get data using data contract and we have a specific like a type of class you know like it's not using the primitive type but a composite type class just to demonstrate right and when it comes to the implementation of that that interface i service the get data does you know like just it if you provide an input from the client so it's a remote procedure call a client will call the server client calls a server with a specific value and it just simply you know like returns uh you entered this particular value similarly for get data using data contract you know whatever input we are sent it uses you know it appends that string with from wcf service hosted in windows container it's a dotnet wcf is tied to windows so you can containerize only to windows containers but when we port it to code wcf uh we can contrast it to linux containers too cool so that's on the service library uh we'll come back to the client but let's look how it is hosted so it's a pretty simple stuff the service host uses the service host it says internal api for service one which is what our service was it opens and as soon as the host is open it starts listening on the particular port and when we you know like as is a sample and if we press enter it is going to close the host where exactly it is listening is defined in app config so this is where when we create a update of a service host this is the app config that it generally takes that so which binding it is the binding is net tcp binding the behaviors of the service right and this is the addresses like you know it works on localhost 81. cool so uh what i'll do is i'll run this you know i'll we'll see a quick demo first on the dotnet framework side of that so let me start this and see which window it's going to open yup so here it is as i said you know simple console application and it says that the service is ready and it is listening now right what i'm going to do i'm going to detach it so that i can run the client on the same instant so i'm going to detach it now let's talk about the client so i still have the service running it's in the background i still have this service running right now client is going to call this service right for that so we have this wcf client uh service client and it is calling that particular api get data with this value 456. and then calling the other uh with the values hello wcftcp client and the bool value is true it's a simple you know client which is calling the service with these values so if i run this and i bring this again here it will show that it has been able to communicate to the service and has been able to get the response okay it went into the brick mode great as always continue execution nope let me rebuild it and see what's the issue that's for the service because service is already running but the client should be fine right yep so if i rebuild the client cool so now if i try and run it again let's see what is the issue yeah okay it's working there we go right so yeah i'm not sure again let me see if i can increase the font of it so it says that it's very able to call the service and we got the response from the service and the client is displaying it so it's kind of you know like in the modern world now we are using all rest apis right but this is what it used to look like a decade ago and you know this has been used very widely very widely uh like i have built multiple applications using wcf because you know at when the time so in initial remote procedure calling.net was known as dotnet remoting uh that was using soap and xml and then microsoft came up with wcf uh which we are looking into right now right and now the overall world modernized to you know like rest apis and then graphql and you know like grpc but there are applications which sit on these and there are you know like companies who actively you know like update these applications um because rewriting them again in the newer framework would be very difficult right and that is why modernizing them in an easy manner to code wcf uh would be uh a great uh option for those customers right so that's on the solution so let's go uh back to our boarding assistant and see how difficult or easy it is to you know like put this application right okay solution file name required i think i had it open here yes so if i go here tcp self-host and i'm going to select this so i've provided uh the solution file of that particular application and click on ss and as you see like it has started accessing this particular application uh so depending upon the complexity of the project uh you know like it may take several minutes uh this particular project has like three projects uh not much like nope commerce takes much more time because it is a quite large uh complex project but this has only three projects in it and not many source files so hopefully it should take less than a minute but yeah we'll get to know uh right now and using porting assistant is there any costs associated with that no porting assistant is a free tool uh by aws it was a leading question from my side [Laughter] all right so the the one you showed us before how how long did that take to process ah no commerce one it took uh you know like on my machine it took around 15 minutes so now this is done like yeah roughly around a minute we can say again you know if we look into the stats so there are three which are not ported there are no packages which are incompatible there are apis which are 8 out of 26 which are incompatible and there are four porting actions right so i've kept this you know like a particular solution quite simple because i want to show more of the wcf how it is being modernized rather than the general business logic code files right so we'll look into that now if i go to wcf yes again we have all this information like at the project level at the project references so if you see project references as we saw right client in itself is an independent one and we had this service library and it is being hosted by the self host so we have just three projects this cell force depends upon service library and client is independent you get packages there are no nuget packages that are being used it's all apis which is you know the bcf apis that are being used there are few which are compatible there are few which are not incompatible i think there would be suggested replacement for few of them like for example this it says this part of wcf won't be ported to dotnet core we can look into here and this is where probably a little bit of manual intervention would be required right again the source files level information is here all right so what we'll do is that we'll put this project and again to port i said you know we can i just click one of them and put the specific project we can select all of them right you know like from here select all of them and port all the projects or multiple projects or we have this option of port solution here which is same as you know like selecting all the projects and click on port project it's like another select yeah so i'm going to click on port project selected all now this is where it says that when we port the application where do you want the application to be saved the ported one to a new location or modify the source in place so if it is in a version control you can always choose modify source in place right it's better ways to cut a branch and then do the porting in it so that then you can see the changes of what changes has been done automatically right so as i i know i cloned it from the get i'm going to use modify source in place and we'll see the changes that were there click on save this shows that you know like okay the new target framework version is dotnet core 3.1 this is the port destination which is the same as the source file and these are the current framework versions and once you're happy with it click on the port now as you see it started porting it may take few minutes again it should not take a lot of time but yeah we'll give it a minute or two for that putting to happen and everything now that happens locally on your client yes the porting happens locally on the client it does communicate you know like uh uh with uh you know like to get few information about the assessment and the manual actions you know the automated actions you need to take so it goes it's let's say if it find a particular pattern which is able to change it so it has to go to uh the repository to find what is the target uh code that i need to replace the source code with it fetches that and changes it on the local so it happens in the local but it there's a communication going on cool so porting is complete uh but it is after the porting it started assessing it again because once you have ported it obviously the stats will change so it is going to assess this particular project again and what do we expect the outcome to be this time then so it should show that ported projects should be three out of three because we have ported all the three now then it should shows the incompatible packages in the apis and in case if there are any build errors as i said i've chosen a simple one so it will not be having a lot of build errors uh but what we'll do then okay it is complete now right so portrait projects is three if you remember in compatible packages there were zero packages that were being used initially right but now we have used eight of them so like wcf do not use like you know kind of packages but now we'll see what kind of packages we are using here we have code wcf packages which we'll see in the project files you know like that has been included and all of them are compatible with the dotnet core in compatible apis there were eight initially out of 26 which were incompatible now we are using 36 and only one of them is incompatible no build errors and all the porting actions has been done we can dive deep into it here but what we'll do is that in the interest of time let's move to the visual studio right and as it has changed the projects right now the project was initially targeting to dotnet framework now it's starting.net core so it will ask us to reload all the projects so i'm going to reload all the projects and let's look into so if you see these are the changes you know yeah is the font good enough to show this you know like because it's a bit like the font can be changed for the source code and not for this particular so this is a visual studio right so but anyways let's look into the get changes it shows all the changes that has been done so first if we talk about wcf library right so what it has done is that all the files which are not being used it has deleted them and created an archive of those so this is like you know these files are not being used anymore in dotnet core version of them the second is there is a modification on iservice okay so let's see this modification all it has done if you see it has replaced system.service model with core wcf right so this service model namespace is used being used in your you know like older versions core wcf is being used in the newer version so this particular change has been done automatically by the tool so developers need not go to each and every file and make this change manually rest it is same it has just done some formatting actually it is the same code but there is no specific code change that has been done so but that's one thing that i wanted to show that the namespace change is being done automatically it identifies the right level of newspapers and changes it now which version of namespace like there were suggested replacements right that we saw there uh so which version of namespace is we can see in the cs proj file so on the left hand side is the project file which is you know targeting to dotnet framework and you can see it is a quiet long file a bit a lot of information so microsoft simplified the overall project file uh greatly uh in the dotnet core version of it okay so it's better to see that you know not in this uh comparison manner but probably directly the source file of the newer version so this is how the latest version of you know like uh project file looks like dot net core 3.1 and then these are the you know like uh nuget packages that are being used new nuget packages code wcf and then it is being exposed at asp.net core the version star means that whichever latest version is there pick it up so that that's the latest stable version we can take it up cool so that's on the changes on the wcf library and it is uh 100 compatible now let's talk about wcf self-host right so if we start looking changes here in the wcf self-host project again the assembly file has been deleted and archived app config file has been deleted archive the information that was there in app config is actually moved to core wcf ported.config so this is the new you know like how it looks like in the modernized world of it it shows that address point is service one net tcp binding configuration and the contract is the business library one i service one right and this is where a small change code change is required right mainly because you need to give the full path a code change is required here like manually now this is being identified and this might be added as one of the repeatable patterns and it's going to do that you know the porting tool this is one small code change that we did manually in the ported file now let's come to program.cs right if you remember in the older version program.cs had this service host which was creating and that and we used to do a host open and host close to actually start listening on a specific port but now and i'll show the new version of it rather than showing in the change version because it is completely different so there's no point in changing it's seeing the changes right so this is how it looks like if i format it ctrl asp.net core developers wouldn't be like more familiar with this that you know this creates the web host builder with the net tcp and uses the curse trail and now it shows that you know it is being listening on 800 8 000 so the overall the mechanism of listening on a specific service source has been changed to use the webcast asp.net core stuff and it uses the startup and if we go to the startup again you know asp.net core developers would be able to understand this adding the service model configuring services and using that service model and this if you see this service model it is being you know like the path to xml this is the xml that is the latest version of code abusive portrait config which we saw and change the changes this is another place where you would might want to make the changes instead of giving this absolute path you might want to give a relative path like you know if you are containerizing it or you having it you know in your specific configuration this might not be the best way but yeah so that's on the changes on the self-host part right so let's try and run this now and then we will deal with the client right we're closing in on top of the hour as well of this episode so while that is building and running if you have any last questions just put them in the chat see if this okay so now it is listening on this particular port application started yeah so now but this application is core wcf so you can run it on linux also so that's the beauty of it now you can customize linux containers and run it on uh you know like yeah linux containers now let's do now let's yeah see what changes were done in the client and how we can do that so again from the project files changes if we see look into it we have added the service model and package references okay this particular part is being used by porting assistant as commented it's only used while putting a you know porting you can always delete it if it is you know like not required it right now program.cs so it was not able to make any changes to the client and remember there was one porting action that was showing so that was for this particular code file actually you know like change so what i'll do is that i'm going to [Music] uh yeah change that to the newer version of codewcf which is mainly to connect to this new port right yes and this is basically what you would do when you're porting an application you'll find those exactly those actions that that the assistant isn't able to do and you'll figure it out yourself uh you know that's what it shows in the you know like uh uh here this is where it will show you right incompatible abs one of 16 so you it it it helps you you know overall understanding where exactly the problem is so if you see program.cs here it clicks here it says that this is where the problem is so it gives you an idea now actually i've changed this so that is why it is showing that it's there so it gives you an idea of which source file to target which line number to target right so now this uses a new uh namespace so we're going to use that namespace and now all done so if we see this particular you know like service which is running right it is running on this particular port and that's why in the service client that we are creating we are saying that you know we are going to connect to this endpoint address and then again call the same contracts so i'm going to detach the service so that i can run the client here in the debug mode right click debug start new instance okay so other points so it says that the project type now is class library and we are run we need to write as an exe so we need to change the project type so right click projects oh not projects properties properties and the output type needs to be a console application then let's save it then right click again debug start new instance now this should be able to communicate with the service and get that data so yeah it has been able to communicate with the service let me increase the font size oh too big but yeah visible to communicate with the service and able to get the data so the whole application remains as it is reporting assistant did a lot of changes automatically few manual actions and we have been able to port the wcf application to core wcf and yeah that's the frankly the end of the demo from the standalone tool very cool so and that brings us to to the end of the show as well so any last thing you want to mention yeah from the developer experience perspective you can always use visual studio uh so in the extensions you can always install porting assistant extension and instead of doing you know like assessment and porting from the standalone tool you can do that from here run full assessment put the solution put a specific projection so you can have that experience from within the visual studio itself the errors that we are seeing that can be seen here in the error list in the warnings so like in this warning specifically we will be able to see all the voting actions you know that will be required very cool all right and with that thank you very much for joining us today and we've had a look at how to modernize your wcf applications using portingassistant4.net and so thank you very much thank you for having me right and thanks to all of our viewers and hope to see you again next week bye you
Info
Channel: Gunnar Grosch
Views: 28
Rating: undefined out of 5
Keywords:
Id: -rGfUc3B_5E
Channel Id: undefined
Length: 60min 34sec (3634 seconds)
Published: Mon Oct 25 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.