locked
Still 404 or 405 error when hosting wcf with IIS RRS feed

  • Question

  • I have read threads about http 404 and 405 error when hosting WCF service using IIS, so:

    1.I have installed IIS correctly

    2.I have run the one-time-wcf-setup

    3.I have run the "ServiceModelsReg.ext -r" in command line

     

    My environment is:

    Windows vista

    IIS 7.0

    Visual studio 2008 RTM

    .NET Framework 3.5

     

    These are steps that I follow in order to create a service

    1.Create a WCF Service Application

    2.Use the default generated IService1 and Service1

    3.Make a client like

    Code Snippet

        public class Client : ClientBase, IService1
        {
            #region IService1 Members

            public string GetData(int value)
            {
                return Channel.GetData(value);
            }

            public CompositeType GetDataUsingDataContract(CompositeType composite)
            {
                return Channel.GetDataUsingDataContract(composite);
            }

            #endregion
        }

     

    4.Create a webform Default.aspx

    5.In the Page_Load of Default.aspx, I write

    Code Snippet

                Client c = new Client();
                string s = c.GetData(3);
                c.Close();
                Response.Write(s);

     

    6.In the web.config, config a client in web.servicemodel section:

     

     

    this is what the project look like when hosting wcf with IIS, when I run the application, entering http://localhots/WcfService1 in IE, it shows the following error

    Exception Details: System.Net.WebException: The remote server returned an error: (404) Not Found.

    I am able to locate the service using the address http://localhost/WcfService1/service1.svc, but http://localhost/WcfService1/service1 is not available and IE shows a 404 error

     

     

    I alwo tried to host the application using Visual studio, then the error is:

    (405) Method not allowed

     

    I cannot see where I did wrong, so if any please tell me, any help would be appreciated, thanks

    Saturday, April 26, 2008 3:22 PM