1. Create a new WCF service, you can create a new class and write it according to the standards of the WCF service.
Interface:
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Runtime.Serialization;
Using System.ServiceModel;
Using System.Text;
Namespace MyService
{
[ServiceContract]
public interface Imyservice
{
[OperationContract]
void DoWork ();
void Closecomputer (string IP);
[OperationContract]
String Registmypcinfo (string mypcinfo);
}
}
Realize:
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Web;
Namespace MyService
{
public class Service:imyservice
{
public void DoWork ()
{
throw new NotImplementedException ();
}
public void Closecomputer (String mac)
{
}
public string Registmypcinfo (string mypcinfo)
{
Return "IP is:" + Mypcinfo + "registered successfully in the database";
}
}
}
2. Just write WCF, no configuration file is written. The host is written below. Create a new empty Web program myhosting, create a new Myservice.svc file in the project, add <%@ ServiceHost language= "C #" debug= "true" service= "with Notepad edit Myservice.service "%> then save. Add a reference-"project-" to the service class project that was just written in the empty Web program. To compile.
3. Build the Myhosting project and place it under the IIS server to start.
IIS as a WCF host, example