c# - WCF Service- Does not implement interface member -
I am following a guide on how to add authorization to the WCF service
now My problem is when I can make the service and remove it from the Dwarver (method), I get an error which says:
'test. Hello-service 'Interface does not test member' test. IHLL service Dockwork ()
This is obviously because I removed it, but is it needed? In the guide it is basically said that it is to remove the Duplar () method, so I am roasting the person who has written that he has missed something.
When I make it service then it adds the HelloService and IHelloService files to the project. Need to add changes to iHelloService?
Here is the code in HelloService.svc.cs
using the system; Using System.Collections.Generic; Using System.Linq; Use the system. time. Timeliness; Using System.ServiceModel; Using System.Text; Using System.Web; Using System.ServiceModel.Activation; Namespace MLA_Test_Service {// Note: To change the class name "HelloService" in the code, svc and config file you can use the "rename" command on the "Refactor" menu. [AspNetCompatibilityRequirements (RequirementsMode = AspNetCompatibilityRequirementsMode.Required)] Public class HelloService: IHelloService {Public string HelloWorld () {return (HttpContext.Current.User.Identity.IsAuthenticated) HttpContext.Current.User.Identity.Name; And "uncertified person" returned; }}} Here is the code from IHelloService.cs
using the system; Using System.Collections.Generic; Using System.Linq; Use the system. time. Timeliness; Using System.ServiceModel; Using System.Text; Namespace MLA_Test_Service {// Note: You can use the "Rename" command on the "Refactor" menu to change the interface name "IHelloService" in both "Code and config file". [ServiceContract] Public Interface IHelloService {[OperationContract] Zero DoWork (); }}
Your implementation needs to match your interface. If you do not want to implement the DoWork method, then it should go from implementation and interface.
In fact, you should probably take the place of a drowner in the name of the method that you really want to do on the service and instead apply that method. It is considered to serve as an example of an operation to start an operation on the WCF service.
Comments
Post a Comment