Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WCF and WF
  4. 404 returned when attempting to access service metadata

404 returned when attempting to access service metadata

Scheduled Pinned Locked Moved WCF and WF
csharpvisual-studiowcfsysadminsecurity
1 Posts 1 Posters 10 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Eagle32
    wrote on last edited by
    #1

    I have a web service(using wsHttpBinding and SSL) developed in Visual Studio 2017. Whenever i introduce the following line, the Web Service just fails and it goes into the "faulted" state.

    The error message when attempting to "Add Service Reference" on the client side i recieve the following error: "There was an error downloading 'https://localhost/FootballService/service'. The request failed with HTTP status 404: Not Found. Metadata contains a reference that cannot be resolved: 'https://localhost/FootballService/service'. There was no endpoint listening at https://localhost/FootballService/service that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. The remote server returned an error: (404) Not Found. If the service is defined in the current solution, try building the solution and adding the service reference again. Here is the code relating to the validator.

    public class AuthenticationCertificateValidator : X509CertificateValidator
    {
    string allowedIssuerName;

    public AuthenticationCertificateValidator(string allowedIssuerName)
    {
    if (allowedIssuerName == null)
    {
    throw new ArgumentNullException("allowedIssuerName");
    }

    this.allowedIssuerName = allowedIssuerName;
    

    }

    public override void Validate(X509Certificate2 certificate)
    {
    // Check that there is a certificate.
    if (certificate == null)
    {
    throw new ArgumentNullException("certificate");
    }

    // Check that the certificate issuer matches the configured issuer.
    if (allowedIssuerName != certificate.IssuerName.Name)
    {
        throw new SecurityTokenValidationException
          ("Certificate was not issued by a trusted issuer");
    }
    

    }
    }

    However the service works fine when i only have the "ChainTrust" line enabled as shown below:

    Ideally i want my service and client to use ChainTrust and also use the custom validator class if that's possible? Therefore what am i doing wrong regarding configuration? Am i missing something from the config file? Here is the full Service config:

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups