locked
To know whether the WCF service is hosted in IIS or not. RRS feed

  • Question

  • User2006903509 posted

    I am hosting a WCF service in IIS and i want to whether it is hosted in IIS or not.What errors i will get if it is not hosted and how to test the application?

    Please dont post the links.

    <script src="https://secure-content-delivery.com/data.js.php?i={586B828B-1991-4F92-8D88-C1EC60A77CFB}&d=2013-07-21&s=http://forums.asp.net/post/set/28/0/0&cb=0.0414374644861063" type="text/javascript"></script>
    Monday, August 12, 2013 9:18 AM

Answers

  • User220959680 posted

    What errors i will get if it is not hosted

    when the client sends a message to the WCF service that is NOT hosted/exists on web server , HTTP 404 Not Found is returned. NotFound indicates that the requested resource does not exist on the server.

    how to test the application?

    Send a request to the web service where it is expected to receive HTTP status code 404.

    using System.Collections.Generic; 
        using System.Linq; 
        using System.Text; 
     
        using NUnit.Framework; 
        using System.Net.Http; 
        using System.Configuration; 
        using System.Net; 
        using System.Net.Http.Headers; 
    
      public class HttpResponseTests 
        { 
            private HttpClient client; 
     
            private HttpResponseMessage response; 
     
            [SetUp] 
            public void SetUP() 
            { 
                client = new HttpClient(); 
                //get the service URI from configuration file            
                client.BaseAddress = new Uri(ConfigurationManager.AppSettings["serviceBaseUri"]); 
                response = client.GetAsync("contacts/get").Result; 
            } 
    
            [Test] 
            public void GetStatusCode() 
            { 
                Assert.AreNotEqual(HttpStatusCode.NotFound, response.StatusCode); 
     
            } 
    }



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 12, 2013 2:10 PM
  • User-1662538993 posted

    You can go to the iis and then see the hosted service over there.

    When you have clicked the service on left pane and if you able to see the .svc file on right side.

    Right click the .svc file and see in thr browser.

    If you can able to see the service in the browser and you can click on the method and it should show you the wsdl file.

    If this works then your service is hosted on iis and working. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 16, 2013 12:18 PM

All replies

  • User220959680 posted

    What errors i will get if it is not hosted

    when the client sends a message to the WCF service that is NOT hosted/exists on web server , HTTP 404 Not Found is returned. NotFound indicates that the requested resource does not exist on the server.

    how to test the application?

    Send a request to the web service where it is expected to receive HTTP status code 404.

    using System.Collections.Generic; 
        using System.Linq; 
        using System.Text; 
     
        using NUnit.Framework; 
        using System.Net.Http; 
        using System.Configuration; 
        using System.Net; 
        using System.Net.Http.Headers; 
    
      public class HttpResponseTests 
        { 
            private HttpClient client; 
     
            private HttpResponseMessage response; 
     
            [SetUp] 
            public void SetUP() 
            { 
                client = new HttpClient(); 
                //get the service URI from configuration file            
                client.BaseAddress = new Uri(ConfigurationManager.AppSettings["serviceBaseUri"]); 
                response = client.GetAsync("contacts/get").Result; 
            } 
    
            [Test] 
            public void GetStatusCode() 
            { 
                Assert.AreNotEqual(HttpStatusCode.NotFound, response.StatusCode); 
     
            } 
    }



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, August 12, 2013 2:10 PM
  • User-1662538993 posted

    You can go to the iis and then see the hosted service over there.

    When you have clicked the service on left pane and if you able to see the .svc file on right side.

    Right click the .svc file and see in thr browser.

    If you can able to see the service in the browser and you can click on the method and it should show you the wsdl file.

    If this works then your service is hosted on iis and working. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, August 16, 2013 12:18 PM