Why can't WCF be called in wcftestclient?

I created a WCF service, it works well in IE addr, but as soon as I add it to wcftestclient and call the method, an error occurred and was shown as:

Failed to call the service. Possible reasons: the service is unavailable or unavailable; client side configuration does not match proxy; existing proxy is invalid. See stack trace for more details. You can try restoring by starting a new proxy server, restoring the default configuration, or updating the service.

Error Details:

The Address property on ChannelFactory.Endpoint was null.  The ChannelFactory Endpoint must have a valid Address specified.
   at System.ServiceModel.ChannelFactory.CreateEndpointAddress(ServiceEndpoint endpoint)
   at System.ServiceModel.ChannelFactory`1.CreateChannel()
   at System.ServiceModel.ClientBase`1.CreateChannel()
   at System.ServiceModel.ClientBase`1.CreateChannelInternal()
   at System.ServiceModel.ClientBase`1.get_Channel()
   at MyDownloadSvcClient.DeleteMyFolder(Int32 UserId, Int32 FolderId)

Configuration file: (updated on 10/9)

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.serviceModel>
        <services>
            <service name="MyDownloadSvcClient">
                <endpoint binding="basicHttpBinding" />
            </service>
        </services>
        <bindings />
        <client>
            <endpoint address="http://localhost/MyDownloadSvc.svc"
                binding="basicHttpBinding" bindingConfiguration="" contract="IMyDownloadSvc"
                name="Test" />
        </client>
    </system.serviceModel>
</configuration>

Is there something wrong?

Thanks in advance, Elaine

+3
source share
5 answers

, - . WCF ABC-, , . - , - null.

, :

<system.serviceModel>
    <services>
        <service name="MyDownloadSvcClient">
            <endpoint 
                address="http://localhost:8888/YourService"
                binding="basicHttpBinding"
                contract="IYourServiceContract" />
        </service>
    </services>

, , . , . WHERE . IIS, *.svc, , , *.svc, - address="" <service>/<endpoint>!

- , .. - .

( , , ), () . , , . WHAT .

+6

IE WebHttpBinding_. , REST, ? ​​ , WcfTestClient.

+2

, .svclog ( IOC... . IOC)

. MDSN , .svclog : https://msdn.microsoft.com/en-us/library/ms732023.aspx

+2

Why are you using custom binding? You have not defined a protocol or created a binding to an existing binding. Just use plain basicHttpBinding.

   <client> 
            <endpoint binding="basicHttpBinding"  contract="IMyDownloadSvc" name="WebHttpBinding_IMyDownloadSvc" address="http://....." /> 
        </client> 

You also need to provide an address.

+1
source

You can also try adding personality to your endpoint:

    <endpoint address ="A" binding="B" contract="C">
      <identity>
        <dns value="localhost"/>
      </identity>
    </endpoint>
0
source

Source: https://habr.com/ru/post/1768576/


All Articles