Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting "can't obtain Metadata (NetTcp Binding)" #907

Open
rezaulk opened this issue Nov 10, 2022 · 2 comments
Open

Getting "can't obtain Metadata (NetTcp Binding)" #907

rezaulk opened this issue Nov 10, 2022 · 2 comments
Labels

Comments

@rezaulk
Copy link

rezaulk commented Nov 10, 2022

When I try to add a WCF service reference from the client. Getting this issue.

             // Add the Echo Service
             builder.AddService<EchoService>(serviceOptions =>
             {
                 // Set the default host name:port in generated WSDL and the base path for the address 
                 serviceOptions.BaseAddresses.Add(new Uri($"http://{HOST_IN_WSDL}/EchoService"));
                 serviceOptions.BaseAddresses.Add(new Uri($"https://{HOST_IN_WSDL}/EchoService"));
             })
             // Add a BasicHttpBinding endpoint
             .AddServiceEndpoint<EchoService, IEchoService>(new BasicHttpBinding(), "/basichttp")
             .AddServiceEndpoint<EchoService, IEchoService>(new BasicHttpBinding(BasicHttpSecurityMode.Transport), "/basichttp")
          
             // Add NetTcpBinding
             .AddServiceEndpoint<EchoService, IEchoService>(new NetTcpBinding(), $"net.tcp://localhost:{NETTCP_PORT}/netTcp");

             // Configure WSDL to be available over http & https
             var serviceMetadataBehavior = 
            app.ApplicationServices.GetRequiredService<CoreWCF.Description.ServiceMetadataBehavior>();
             serviceMetadataBehavior.HttpGetEnabled = serviceMetadataBehavior.HttpsGetEnabled = true;

I run sample projects.
CoreWcf Sample server

image

@mconnew
Copy link
Member

mconnew commented Nov 10, 2022

To use a net.tcp address you need to have a SOAP endpoint serving requests for IMetadataExchange. WCF does this for you, but this wasn't implemented in CoreWCF. You need to point Add Service Reference to an http url to have it download the wsdl file over http. This should still provide you the bindings for net.tcp as the wsdl contains all bindings for all transports being used.

@rezaulk rezaulk changed the title Getting can't obtain Metadata (NetTcp Binding) Getting "can't obtain Metadata (NetTcp Binding)" Nov 11, 2022
@rezaulk
Copy link
Author

rezaulk commented Nov 11, 2022

Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants