Migrating a WCF application to gRPC
Visual ReCode has two migration options:
- Service Migration: Select a service, convert it to gRCP
- Guided Project Upgrades: Finds the optimal order to upgrade a whole project.
In this section of the documentation, we will cover the Service Migration process.
The Service Migration wizard is an interface that guides you through creating WCF to gRPC migrations. With your WCF solution open, click Extensions -> Visual ReCode -> Migrate a WCF service to gRPC… from the top-level menu.
Step 1: Choose a WCF Service Contract
The first page of the wizard shows all the
ServiceContract classes and interfaces
in the currently-opened solution, grouped by project. If your project contains
multiple implementations of a
ServiceContract interface, all of them will be
displayed in the list, so take care to select the right one.
Step 2: Configure Output
On the next page you specify a new solution to create, as well as a name for the .NET Core gRPC Project to be generated. Required code from your current solution will be copied into .NET Standard 2.1 library projects in the new solution, with the same names and structure as your existing solution, so you should be able to find your way around.
You can also choose to generate a Client Project. Visual ReCode will produce
a standalone library project with the gRPC client generated from the
and a custom wrapper around that client which matches the interface of the old WCF
client. The generated project targets both .NET 4.5 and .NET Standard 2.1, so you
can use it in existing client applications to make the migration process easier.
Finally, you can generate a WCF Proxy Project. This option creates a proxy project to allow WCF applications to communicate with your gRPC service. The Proxy application is a very thin wrapper around the gRPC client, using either basicHttpBinding for simple request/reply services, or wsDualHttpBinding for duplex services. You will want to configure or tweak the bindings to match your original WCF service.
Step 3: Save gRPC Migration
Provide a name for the migration you are creating. Visual ReCode will add a
migration file with this name and the
.recode extension to
Visual ReCode Solution Folder in your current solution. This file can be
checked into source control and used to re-run the migration as often as needed.
If you leave the Run migration now checkbox checked, the file will be saved and the migration will run immediately. Otherwise you can click the Run Migration button in the Migration document window.
Step 4: Building gRPC Solution
This is a non-interactive page that displays information about the gRPC solution model as it is built in memory. For large solutions this process may take a while.
Step 5: Solution Preview
The next page shows a tree view of the Solution that will be generated with all the generated and migrated files. If everything looks OK then click Next and the solution will be written to disk.
The progress bar shows the progress of writing the generated and migrated projects and documents to the new Solution. Once this is completed, you can open the new Solution in Visual Studio or File Explorer, or view the HTML Migration Report in your default browser. The Migration Report is included in the new Solution so you can review it at any time.
Note on the Trial Version of Visual ReCode
If you are using the Visual ReCode trial, it is important to note that it does not work exactly the same as the full version.
The trial version arbitrarily copies all the types across with all their methods, but it only copies the body of one in three methods. Additionally, the trial does not support the creatation of the .recode “migration” documents.