Awarious OfficePortal - HRMS Application

Issue while hosting WCF Service using windows services

0 votes
asked Jun 20, 2013 in WCF by anonymous

I am trying to host a WCF server using windows services because the service is going to be hosted in each and every client machine. I have written the below code in the OnStart event of windows service. I have installed the windows service successfully and started the service without any problem. But when I tried to access the service endpoint using url address, application not able to reach the service. Also, when I tried to view the wsdl information using internet explorer (I have enabled the httpGetEnabled), browser returned error message to check the connectivity. When I run diagnosis, it said that the service is not accepting any request from outside. I am not sure what is wrong in the below code. Please help me.

protected override void OnStart(string[] args)
    using(ServiceHost host = new ServiceHost(typeof(myservice)))

1 Answer

0 votes
answered Jun 21, 2013 by anonymous
selected Jun 30, 2013 by administrator
Best answer

I think the issue is because you are hosting your wcf service by wrapping within 'using' block. When you use 'using', right after it executes all code inside the using block, it will call dispose method to dispose the host object. Because of that, your host would have been closed and you are not able to access the service.

Your answer


Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
site design / logo / content © 2013 - 2019