Coffeehouse Thread

6 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

WCF Error

Back to Forum: Coffeehouse
  • User profile image
    shahrooz

    Hello this my app Config Code but when i run this service give error

     

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

           
    <system.web>
                   
    <compilationdebug="true"/>
           
    </system.web>

           
    <system.serviceModel>
                   
    <services>
                           
    <servicename="EvalServiceLibrary.EvalService">
                                   
    <clear/>
                                   
    <endpointaddress="ws"binding="wsHttpBinding"contract="EvalServiceLibrary.IEvalService"
                                     
    listenUriMode="Explicit">
                                           
    <identity>
                                                   
    <dnsvalue="localhost"/>
                                                   
    <certificateReferencestoreName="My"storeLocation="LocalMachine"
                                                     
    x509FindType="FindBySubjectDistinguishedName"/>
                                           
    </identity>
                                   
    </endpoint>
                                   
    <endpointaddress="mex"binding="mexHttpBinding"contract="IMetadataExchange"
                                     
    listenUriMode="Explicit"isSystemEndpoint="false">
                                           
    <identity>
                                                   
    <certificateReferencestoreName="My"storeLocation="LocalMachine"
                                                     
    x509FindType="FindBySubjectDistinguishedName"/>
                                           
    </identity>
                                   
    </endpoint>
                                   
    <endpointaddress="basic"binding="basicHttpBinding"contract="EvalServiceLibrary.IEvalService"
                                     
    listenUriMode="Explicit">
                                           
    <identity>
                                                   
    <certificateReferencestoreName="My"storeLocation="LocalMachine"
                                                     
    x509FindType="FindBySubjectDistinguishedName"/>
                                           
    </identity>
                                   
    </endpoint>
                                   
    <endpointaddress="net.tcp://localhost:8888/EvalService"binding="netTcpBinding"
                                     
    contract="EvalServiceLibrary.IEvalService"listenUriMode="Explicit">
                                           
    <identity>
                                                   
    <certificateReferencestoreName="My"storeLocation="LocalMachine"
                                                     
    x509FindType="FindBySubjectDistinguishedName"/>
                                           
    </identity>
                                   
    </endpoint>
                                   
    <endpointaddress="net.pipe://localhost/EvalService"binding="netNamedPipeBinding"
                                     
    bindingConfiguration=""contract="EvalServiceLibrary.IEvalService"/>
                                   
    <host>
                                           
    <baseAddresses>
                                                   
    <addbaseAddress="http://localhost:8888/EvalService"/>
                                           
    </baseAddresses>
                                   
    </host>
                           
    </service>
                   
    </services>
                   
    <behaviors>
                           
    <serviceBehaviors>
                                   
    <behavior>

                                           
    <serviceMetadatahttpGetEnabled="True"/>

                                           
    <serviceDebugincludeExceptionDetailInFaults="False"/>
                                   
    </behavior>
                           
    </serviceBehaviors>
                   
    </behaviors>
           
    </system.serviceModel>

    </configuration>

     

    thisismy error

     

    System.InvalidOperationException: Cannot load the X.509 certificate identity specified in the configuration.
    at System.ServiceModel.Description.ConfigLoader.LoadIdentity(IdentityElement element)
    at System.ServiceModel.Description.ConfigLoader.LoadServiceDescription(ServiceHostBase host, ServiceDescription description, ServiceElement serviceElement, Action`1 addBaseAddress)
    at System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, ServiceElement serviceSection)
    at System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, String configurationName)
    at System.ServiceModel.ServiceHostBase.ApplyConfiguration()
    at System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses)
    at System.ServiceModel.ServiceHost.InitializeDescription(Type serviceType, UriSchemeKeyedCollection baseAddresses)
    at System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
    at Microsoft.Tools.SvcHost.ServiceHostHelper.CreateServiceHost(Type type, ServiceKind kind)
    at Microsoft.Tools.SvcHost.ServiceHostHelper.OpenService(ServiceInfo info)

     

     

    Adding the following tag inside   <identity> worked for me.

     

             <dns value="localhost" />

     

    but doesn't work

     

    and i add 

     

    			<endpointBehaviors>
    <behavior name="clientBehavior">
    <clientCredentials>
    <serviceCertificate>
    <authentication revocationMode="NoCheck"/>
    </serviceCertificate>
    </clientCredentials>
    </behavior>
    </endpointBehaviors>

     

    but doesn't work

     

  • User profile image
    shahrooz

    Help me please

     

  • User profile image
    blowdart

    The PC you're running it on doesn't have a certificate for localhost, or the private key is not accessible to the context the service is running under.

  • User profile image
    cbae

    @shahrooz: You have no findValue attribute in any of your certificateReference elements. Since all of your endpoints are using FindBySubjectDistinguishedName, you just need to add findValue="<subjectdistinguishedname>" attribute to the certificateReference element of each endpoint.

    If you're hosting your service in IIS, you'll have to check the certificates that IIS is using and look at the certificate details to get the subject distinguished name.

  • User profile image
    shahrooz

    how can i fixed it help me plz

  • User profile image
    blowdart

    , shahrooz wrote

    how can i fixed it help me plz

    By adding the host name to the findvalue attribute, and of course making sure the certificate exists and is permissioned correctly.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.