Endpoint is null?

1.7k views Asked by At

I get the following error:

The Address property on ChannelFactory.Endpoint was null. The ChannelFactory's Endpoint must have a valid Address specified

But I have an adress for the client endpoint, what is going on here?

Code:

 ChannelFactory<CommService.ITwService> myChannelFactory 
 = new ChannelFactory<CommService.ITwService>();
 CommService.ITwService wcfClient1 = myChannelFactory.CreateChannel();

Client:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>

  <system.web>
    <compilation debug="true" />
  </system.web>
  <!-- When deploying the service library project, the content of the config file must be added to the host's 
  app.config file. System.Configuration does not support config files for libraries. -->
  <system.serviceModel>
    <client>
      <endpoint address="http://localhost:8732/Design_Time_Addresses/CommService/Service1/"
        binding="wsHttpBinding" contract="CommService.ITwService"
        name="Super">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
    </client>
    <services />
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, 
          set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="True"/>
          <!-- To receive exception details in faults for debugging purposes, 
          set the value below to true.  Set to false before deployment 
          to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

</configuration>

Server:

  <?xml version="1.0" encoding="utf-8" ?>
  <configuration>

    <system.web>
      <compilation debug="true" />
    </system.web>
    <!-- When deploying the service library project, the content of the config file must be added to the host's 
    app.config file. System.Configuration does not support config files for libraries. -->
    <system.serviceModel>
      <client>
        <endpoint address="http://localhost:8732/Design_Time_Addresses/CommService/Service1/"
          binding="wsHttpBinding" bindingConfiguration="" contract="CommService.ITwService"
          name="" kind="" endpointConfiguration="">
          <identity>
            <dns value="localhost" />
            <certificateReference storeName="My" storeLocation="LocalMachine"
              x509FindType="FindBySubjectDistinguishedName" />
          </identity>
        </endpoint>
      </client>
      <services>
        <service name="CommService.Service1">
          <endpoint address="SuperEndPoint" binding="wsHttpBinding" name="SuperEndPoint"
            contract="CommService.ITwService">
            <identity>
              <dns value="localhost" />
            </identity>
          </endpoint>
          <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
          <host>
            <baseAddresses>
              <add baseAddress="http://localhost:8732/Design_Time_Addresses/CommService/Service1/" />
            </baseAddresses>
          </host>
        </service>
      </services>
      <behaviors>
        <serviceBehaviors>
          <behavior>
            <!-- To avoid disclosing metadata information, 
            set the value below to false and remove the metadata endpoint above before deployment -->
            <serviceMetadata httpGetEnabled="True"/>
            <!-- To receive exception details in faults for debugging purposes, 
            set the value below to true.  Set to false before deployment 
            to avoid disclosing exception information -->
            <serviceDebug includeExceptionDetailInFaults="False" />
          </behavior>
        </serviceBehaviors>
      </behaviors>
    </system.serviceModel>

  </configuration>
1

There are 1 answers

0
Nahum On BEST ANSWER

solved this by creating a new project.. creating the files and copying the code to the new project using copy paste.. weird.