I have created a WCF service with some endpoints(with mex endpoint).
If i create for example a Console Host now and put this in my main:
ServiceHost host = new ServiceHost(typeof(HelloWorld));
host.Open();
Console.WriteLine("The service is ready at!");
foreach (ServiceEndpoint se in host.Description.Endpoints)
Console.WriteLine(se.Address.ToString());
Console.WriteLine("Press <Enter> to stop the service.");
Console.ReadLine();
// Close the ServiceHost.
host.Close();
Is it possible to generate a app.config on the hostside by adding a service reference, or do i need to create the app config my self and make it similar to the wcf service endpoints?
Next to this, how is it possible that some other computer on the LAN can access this host?
(PS what the heck does this mean: A service may inlcude an mex endpoint, which obtain the ABC’s of the service and returns the WSDL. (NOW THE NOT UNDERSTANDABLE PART) After the WSDL is obtained, two artifacts are generated: a proxy class in the language of the project and an app.config file. The proxy class mirrors the signature of the endpoint operations so that client code can simply “call”an endpoint. The proxy interface doesn’t have to be identical to the service signature, but the proxy needs to ensure that the message transmitted to the service is precisely what is described by the service contract.(OK WHAT?)
1) You have to specify endpoints(A-Address,B-Binding,C-contract) in the app.config and this app.config must be with your host app(Your console app in this case)
2) This service can be recognized in the LAN if some client runs visual studio’s command prompt and runs this-
SvcUtil http://localhost/MyService/MyService.svc /out:c:\Proxy.cs (sample command change various values as per your case…)
Here Proxy.cs contains Proxy class, the client should add this to the solution and calls the method of proxy class, in the same directory where this Proxy.cs exists, you will find 1 .config file, paste this file’s contents to the client’s app.config.
3) MEX endpoint is required to exchange meta information.