locked
multiple endpoint bindings fail RRS feed

  • Question

  •  

    I am trying to create a basicHTTPBinding and a wsHttpBinding for my service.  The endpoints are

    1. for the basic:   http://{baseaddress}/myservice.svc/basic

    2. and for the ws: http://{baseaddress}/myservice.svc

     

    The ws binding works fine, but the basic gives and error that there is no enpoint listening that could accept the message at http://{baseaddress}/myservice.svc/basic.  It seems that if I have added anything to the end of the base address, wcf will not work.

     

    I have followed the examples on MSDN and in forums.  What seems to work for others, just isn't hacking it for me.

    What am I missing here??

    Monday, September 10, 2007 3:53 PM

Answers

  • Well...  an update for those curious about the solution.
    Here is what I have determined.   The problem seems to lie with IIS 5.1.
    IIS 5.1 will not resolve the url correctly and returns a 404 error.  IIS is responsible for the 404 error. 
    The same code works fine on IIS 6.0.
    Wednesday, October 24, 2007 12:57 PM

All replies

  • I just tried the example below, and it worked fine. Can you check if there are any differences between what we have?

     

    Service:

    namespace WCFTestModule

    {

        [ServiceContract]

        interface ITest

        {

            [OperationContract]

            string Echo(string str);

        }

        public class Service : ITest

        {

            public string Echo(string str)

            {

                return str;

            }

        }

    }

     

    Web.config:

    <system.serviceModel>

        <behaviors>

            <serviceBehaviors>

                <behavior name="MyBehavior">

                    <serviceMetadata httpGetEnabled="true" />

                </behavior>

            </serviceBehaviors>

        </behaviors>

        <services>

            <service behaviorConfiguration="MyBehavior" name="WCFTestModule.Service">

                <endpoint address="" binding="wsHttpBinding" bindingConfiguration=""

                    contract="WCFTestModule.ITest" />

                <endpoint address="basic" binding="basicHttpBinding" contract="WCFTestModule.ITest" />

            </service>

        </services>

    </system.serviceModel>

     

    After generating the client/config via svcutil, this client code below was able to successfully call the services:

    namespace WCFTestApp

    {

        class Program

        {

            static void Test(TestClient client, string test)

            {

                Console.WriteLine(test);

                Console.WriteLine(" Server address: " + client.Endpoint.Address.Uri);

                Console.WriteLine(" Calling Echo: " + client.Echo("Hello world"));

            }

            static void Main(string[] args)

            {

                TestClient ws = new TestClient("WSHttpBinding_ITest");

                TestClient basic = new TestClient("BasicHttpBinding_ITest");

                Test(basic, "BasicHttpBinding");

                Test(ws, "WSHttpBinding");

                ws.Close();

                basic.Close();

            }

        }

    }

    Tuesday, September 11, 2007 4:34 PM
  • I can get this to work if my host and client are console apps.  But if my host is IIS, I get the error "there is no endpoint listening at {baseaddress}/basic that could accept the message."   The inner exception indicates a 404 error.
    Wednesday, September 12, 2007 8:05 PM
  • Are you using svcutil/add service reference to create a proxy to talk to the server, or are you using the ChannelFactory<> directly? The example that I posted before worked fine on IIS.

     

    Can you post the web.config file you're using inside the vdir?

    Wednesday, September 12, 2007 9:54 PM
  • I am just using the "AddServiceReference" from VS menu.  However, I have also used the svcutil from command line and got the same results.  I have tried this with a couple of different projects, and all have the same result.
    //***********************************

    Here is the code in my vdir web config:
    //***********************************
    Code Snippet

    <?xml version="1.0"?>
    <configuration>
        <appSettings/>
        <connectionStrings/>
        <system.web>     
            <compilation debug="false">
                <assemblies>
                    <add assembly="System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                    <add assembly="Microsoft.Transactions.Bridge, Version=3.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                    <add assembly="SMDiagnostics, Version=3.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.IdentityModel.Selectors, Version=3.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                    <add assembly="System.Web.RegularExpressions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                    <add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.Messaging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                    <add assembly="System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies></compilation>
           
            <authentication mode="Windows"/>       
        </system.web>
      <system.serviceModel>
           <services>
                <!-- Before deployment, you should remove the returnFaults behavior configuration to avoid disclosing information in exception messages -->
             <service name="EndpointSample.service1"
                 behaviorConfiguration="metadataSupport">
               <endpoint address="" contract="EndpointSample.IService1" binding="wsHttpBinding"/>
               <endpoint address="basic" binding="basicHttpBinding" contract="EndpointSample.IService1" />
               <endpoint address="mex" binding="mexHttpBinding" name="Mex" contract="IMetadataExchange" />
             </service>
        </services>               
          <behaviors>
              <serviceBehaviors>
                <behavior name="metadataSupport">
                  <!-- Enables the IMetadataExchange endpoint in services that -->
                  <!-- use "metadataSupport" in their behaviorConfiguration attribute. -->
                  <!-- In addition, the httpGetEnabled and httpGetUrl attributes publish -->
                  <!-- Service metadata for retrieval by HTTP/GET at the address -->
                  <!-- "http://localhost:8080/SampleService?wsdl" -->
                  <serviceMetadata httpGetEnabled="true" httpGetUrl=""/>                  
                  <serviceDebug includeExceptionDetailInFaults="true" />
                </behavior>
              </serviceBehaviors>       
          </behaviors>
       
      </system.serviceModel>
    </configuration>



    //***********************************

    And here is my client app.config

    //***********************************


    Code Snippet

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <system.serviceModel>
            <bindings>
                <basicHttpBinding>
                    <binding name="BasicHttpBinding_IService1" closeTimeout="00:01:00"
                        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                        allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                        maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                        messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                        useDefaultWebProxy="true">
                        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                        <security mode="None">
                            <transport clientCredentialType="None" proxyCredentialType="None"
                                realm="" />
                            <message clientCredentialType="UserName" algorithmSuite="Default" />
                        </security>
                    </binding>
                </basicHttpBinding>
                <wsHttpBinding>
                    <binding name="WSHttpBinding_IService1" closeTimeout="00:01:00"
                        openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
                        bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
                        maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                        messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
                        allowCookies="false">
                        <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                        <reliableSession ordered="true" inactivityTimeout="00:10:00"
                            enabled="false" />
                        <security mode="Message">
                            <transport clientCredentialType="Windows" proxyCredentialType="None"
                                realm="" />
                            <message clientCredentialType="Windows" negotiateServiceCredential="true"
                                algorithmSuite="Default" establishSecurityContext="true" />
                        </security>
                    </binding>
                </wsHttpBinding>
            </bindings>
            <client>
                <endpoint address="http://THEMACHINENAME.THEDOMAIN.com/endpointTest/service.svc"
                    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1"
                    contract="WebClient.webservice.IService1" name="WSHttpBinding_IService1">
                    <identity>
                        <userPrincipalName value="THEMACHINENAME\ASPNET" />
                    </identity>
                </endpoint>
                <endpoint address="http://THEMACHINENAME.THEDOMAIN.com/endpointTest/service.svc/basic"
                    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
                    contract="WebClient.webservice.IService1" name="BasicHttpBinding_IService1" />
            </client>
        </system.serviceModel>
    </configuration>





    Thursday, September 13, 2007 1:51 PM
  • I had the same problem when used your web.config file, and by removing the httpGetUrl="" from the serviceMetadata element in the behaviors section, the problem went away. Can you try it?

     

      <system.serviceModel>
           <services>

               ...
        </services>               
          <behaviors>
              <serviceBehaviors>
                <behavior name="metadataSupport">
                  <serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
                  <serviceDebug includeExceptionDetailInFaults="true" />
                </behavior>
              </serviceBehaviors>       
          </behaviors>
      </system.serviceModel>


     

    Thursday, September 13, 2007 8:47 PM
  • I tried, but still get the same error.
    Thursday, September 13, 2007 9:55 PM
  • This post might help you, i'm not sure its exactly the same situation but it might be related:

     

    http://www.masteringbiztalk.com/blogs/jon/PermaLink,guid,9e0d8d1e-ac7c-49b5-8072-bde42609f5db.aspx

     

    Also consider this post on HostName Comparison Mode

     

    http://kennyw.com/indigo/109

    Friday, September 28, 2007 9:57 PM
  • Well...  an update for those curious about the solution.
    Here is what I have determined.   The problem seems to lie with IIS 5.1.
    IIS 5.1 will not resolve the url correctly and returns a 404 error.  IIS is responsible for the 404 error. 
    The same code works fine on IIS 6.0.
    Wednesday, October 24, 2007 12:57 PM
  •  

    hi,

    It seems your client app.config ( or web.config) end point doesn't have appropriate name. Try to add name="basic" to the end point which is associated with basicHttpBinding.

    -vasu

    Friday, November 2, 2007 9:51 AM
  • A way i found to solve this issue is to update the entire operating system (both critical and non critical updates) on everything related to .Net Framework 3.0 as well as security and O.S. updates. It seems to be inside a windows fix (not inside FW3.0 nor it's service pack), because the internet explorer answered well at wsdl. It seems to be a little exceptions (because here, one of each... 50 computers presents this issue). So... if none of the above solved your issue, consider to keep the issued PC the most up to date as possible.

     

    i'm trying to find the exact fix. If found 'll tell U

     

    Hope it helps

     

    Rick.

    MCPD - EA

    MCITP - DD

    Monday, April 14, 2008 2:20 PM
  • Solved.

     

    There are many possibilities, most of them are solved by debugging exceptions on server and client, because many times message does not reflect the symptoms. Try debugging them on Visual Studio IDE(both thrown and created -do this with CTRL+ALT+E-). Possible causes vary from timeout on the server, uncomplete references to real communication issues as wrong DNS, firewall, LAN security.

     

    if Exception debugging doesn't works for you, you would analyze the packets on your network adapter (try WireShark warning, it's not so acceptable depending on your company's security policies).

     

    Good Luck!

     

    Ricardo Adolfo González Pineda

    MCPD, MCITPD, Biztalk TS

     

    Wednesday, October 1, 2008 10:54 PM