locked
WCF service not working after hosting in IIS RRS feed

  • Question

  • User-720893289 posted

    Hi Friends,

    I am new for WCF. I have created a simple wcf service. This service simply fetches data from my another application and returns in the form of dataset. In the same solution I have created a web application as a client to access this wcf service. Now in the client application I have added a service reference from the solution itselrf and the service runs very well. it returns the data perfectly.

    Now the problem occures when I have hosted the service in IIS (IIS 7).  Now I have removed the existing service reference (which was from the same solution) and then added a new reference from the hosted service. Now when I run the client web application, my client did not give any error / exception but did not fetch any data from the service. I am not sure why the service did not return any data after hosting in IIS.

    In my client application i have this simple code only.

    Service1Client serCli = new Service1Client();

    serCli.PerformInit("SAMPLE", "SAMPLE", "SAMPLE", "SAMPLE");

    DataSet ds = serCli.GetData("Param1", "Param2", "Param3");

    GridView1.DataSource = ds;

    I am excpecting data in ds. Please let me know the probable issue or solution. Let me know if more info is required regarding this issue.

    Regards,
    Girish

    Tuesday, February 19, 2013 10:33 PM

Answers

  • User-1000095884 posted

    Hi,

    If you mean host the service in IIS, the simply way is creating a service with WCF Service Application template in Visual Studio, then create a client app to consume the service by "Add Service Reference".

    If you mean publish the service to IIS and consume the service from a client, you can refer the steps in a MSDN document below to publish the service.

    #WCF Service Publishing

    http://msdn.microsoft.com/en-us/library/bb924407.aspx

    I am not sure why the service did not return any data after hosting in IIS.

    If you have published the service to IIS, can you call other functions( except the one used to return data) properly?

    Best Regards,

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 21, 2013 9:14 PM
  • User220959680 posted

    But after hosting the sercvice to IIS on that perticular method I am getting stackoverflow exception. Any inputs on this behaviour? How I can find the reason for this behviour or how I can fix this.

    Make sure that service is published successfully to the IIS. As your initial query has been resolved, mark the correct response and close the thread.

    Open new thread with your current issue, so that you can get further help.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 26, 2013 8:44 AM

All replies

  • User220175380 posted

    Hi,

    Please follow the below linq it will provides the steps for hosting the WCF and Web application in IIS.

    http://forums.asp.net/t/1866807.aspx/1?Deploy+WCF+webservice+Windows+service+and+Website

    Tuesday, February 19, 2013 11:18 PM
  • User-720893289 posted

    Thanks farooque,

    I have already done all the settings, and while accessing the service I am not getting any error/exception

     but my client is not getting any data from the service.

    Wednesday, February 20, 2013 12:57 AM
  • User-1000095884 posted

    Hi,

    If you mean host the service in IIS, the simply way is creating a service with WCF Service Application template in Visual Studio, then create a client app to consume the service by "Add Service Reference".

    If you mean publish the service to IIS and consume the service from a client, you can refer the steps in a MSDN document below to publish the service.

    #WCF Service Publishing

    http://msdn.microsoft.com/en-us/library/bb924407.aspx

    I am not sure why the service did not return any data after hosting in IIS.

    If you have published the service to IIS, can you call other functions( except the one used to return data) properly?

    Best Regards,

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, February 21, 2013 9:14 PM
  • User-720893289 posted

    Oh yes,

    I have not considered it yet, but when I have tried with a simple method which returns true / false, I can call this method successfully and it returns the correct data as specified in the service.
    Now the question remains that what happens to the dataset, which I am trying to return from the prior method?

    Any clue guys?

    Regards,
    Girish

    Friday, February 22, 2013 7:43 AM
  • User-720893289 posted

    Hey guys I have got the answer that why my service was not returning data as in  the method I was trying to access some local sources i.e some file from temp folder but now another issue is that the service does not have access to the local path. Now how to overcome this please help me.

    Regards,
    Girish

    Friday, February 22, 2013 9:28 AM
  • User220959680 posted

    From the description it is evident that the service is SOAP based one.

    1. use WCF Test Client tool as explained here to check whether your hosted service is returning any data or not. http://msdn.microsoft.com/en-us/library/bb552364.aspx
    2. Debug the client by enabling tracing in your service to know the reason behind this behavior. http://msdn.microsoft.com/en-us/library/ms733025.aspx
    Friday, February 22, 2013 8:14 PM
  • User-720893289 posted

    Hi Sukumar,

    My Service is running correctly now the issue I have written a code in my service that access temp folder. Now when I run this as a service my service returns an error saying that "No access for temp folder". How to oversome this?

    Regards,
    Girish

    Monday, February 25, 2013 7:24 AM
  • User-720893289 posted

    Thanks Sukumar,

    After adding permission to the application Pool I have now acces sissue resolved. Now again i am facing another issue, I have a method GetData() in my webservice which used another dll which is loaded using reflection to get the data and return it to the client. Now when I add the service reference from the solution it works file and return the data. But after hosting the sercvice to IIS on that perticular method I am getting stackoverflow exception. Any inputs on this behaviour? How I can find the reason for this behviour or how I can fix this.

    Regards,
    Girish

    Tuesday, February 26, 2013 7:33 AM
  • User220959680 posted

    But after hosting the sercvice to IIS on that perticular method I am getting stackoverflow exception. Any inputs on this behaviour? How I can find the reason for this behviour or how I can fix this.

    Make sure that service is published successfully to the IIS. As your initial query has been resolved, mark the correct response and close the thread.

    Open new thread with your current issue, so that you can get further help.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, February 26, 2013 8:44 AM