Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My Web.confing


XML
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyOwnBehavior">
          <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" />
          <serviceCredentials>
            <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="WcfService_Project.UNValidator,WcfService_Project" />
          </serviceCredentials>
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <bindings>
      <wsHttpBinding>
        <binding name="MyOwnBinding">
          <security mode="TransportWithMessageCredential">
            <transport clientCredentialType="None" />
            <message clientCredentialType="UserName" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>

    <services>
      <service behaviorConfiguration="MyOwnBehavior" name="WcfService_Project.Service1">
        <endpoint address="https://localhost/WcfService_Project/Service1" binding="wsHttpBinding" bindingConfiguration="MyOwnBinding" name="TestWCFService.Http" contract="WcfService_Project.IService1" />
        <host>
          <baseAddresses>
            <add baseAddress="https://localhost/WcfService_Project/Service1" />
          </baseAddresses>
        </host>
      </service>
    </services>
  </system.serviceModel>
  <system.web>
    <compilation debug="true" />
  </system.web>
  <system.webServer>
    <directoryBrowse enabled="true" />
  </system.webServer>
</configuration>



Client

<pre lang="c#">
C#
EndpointAddress ep = new EndpointAddress(new Uri(
               "https://localhost/Service1.svc?wsdl"));
            //transport encrypting with SOAP message authentication
            WSHttpBinding bind = new WSHttpBinding(
                     SecurityMode.TransportWithMessageCredential);
            //10 sec timeouts
            bind.ReceiveTimeout = new TimeSpan(0, 0, 10);
            bind.SendTimeout = new TimeSpan(0, 0, 10);
            bind.BypassProxyOnLocal = false; // to be able bedugging eg. with fiddler
            bind.UseDefaultWebProxy = true; //use default system proxy
            //this we need for our custom credentials
            bind.Security.Message.ClientCredentialType =
                                  MessageCredentialType.UserName;

            ServiceReference1.Service1Client obj = new ServiceReference1.Service1Client(bind, ep);
            obj.ClientCredentials.UserName.UserName = "test";
            obj.ClientCredentials.UserName.Password = "best";
            return obj;


Error: There was no endpoint listening at https://localhost/WcfService_ProjNew/Service1.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

I tried to connect with system name(https://localhost/WcfService_ProjNew/Service1.svc[^]) also but same error.

Where I have done wrong.

Thanks in advance
Posted
Updated 19-Dec-13 23:56pm
v2
Comments
Jobless Creature 20-Dec-13 22:33pm    
Can you try setting the name attribute with the class name?

name="TestWCFService.Http"

can be changed to service class name.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900