Home > Software design >  Hide svc side in web application using SoapCore library
Hide svc side in web application using SoapCore library

Time:09-10

I have simple structure in my web application. enter image description here

Is there any chance to hide a wsdl source in url https://localhost:7189/Service.svc to keep it unvisible from users? enter image description here

I tried to create web.config and enter there some settings which I found but this not gave me expected results.

Solution:

app.UseEndpoints(endpoints =>
{
    endpoints.UseSoapEndpoint<BookService>(new Action<SoapCoreOptions>(CreateBookServiceEndpoint));
});

void CreateBookServiceEndpoint(SoapCoreOptions target)
{
    target.HttpGetEnabled = false;
    target.HttpsGetEnabled = false;
    target.Path = "/BookService.svc";
    target.EncoderOptions = new SoapEncoderOptions[] { new SoapEncoderOptions() };
    target.SoapSerializer = SoapSerializer.XmlSerializer;
}

CodePudding user response:

Looks like you can't issue GET requests when HttpsGetEnabled or HttpGetEnabled are false (for HTTPS/HTTP requests respectively), so something like this:

.UseSoapEndpoint(..., options => 
{
    HttpGetEnabled = false,
    HttpsGetEnabled = false,
});
  • Related