How to convert WCF Rest Service code to CoreWCF Rest Service

243 Views Asked by At

I have below lines of code and as we know WebInvoke enables Rest Service capablity. I am converting my code to CoreWCF but WebInvoke is not supported.

[OperationContract]
[WebInvoke(Method = "POST", 
RequestFormat = WebMessageFormat.Json, 
ResponseFormat = WebMessageFormat.Json, 
UriTemplate = "GetUserData", 
BodyStyle = WebMessageBodyStyle.WrappedRequest)]
string GetUserDetails();

I tried adding below namespace but still it is not supported.

using Microsoft.AspNetCore.Mvc;

Can someone help me to convert the above lines of code to CoreWCF.

1

There are 1 best solutions below

0
QI You On

I think you can use . NET Upgrade Assistant.

.NET Upgrade Assistant is a command-line tool that can run on different types of .NET Framework applications. It is designed to help upgrade .NET Framework apps to .NET 6. After you run this tool, in most cases, the app will require additional action to complete the migration. This tool installs analyzers that can help complete the migration.

Here are some documents that you might find helpful:

Document1

Document2

Best Regards