IdentityServer / IdentityServer2

[deprecated] Thinktecture IdentityServer is a light-weight security token service built with .NET 4.5, MVC 4, Web API and WCF.
Other
410 stars 291 forks source link

Could not find a base address that matches scheme http for the endpoint with binding CertificateWSTrustBinding #880

Open minarikjan opened 8 years ago

minarikjan commented 8 years ago

I try use sample WcfIdentity45 > WSTrust > Symmetric from Pluralsight course Identity and Access Control in WCF 4.5.

Course url.

I use IdentityServer v2.5.

From client I request for token via WSTrustChannelFactory.

            var binding = new UserNameWSTrustBinding(SecurityMode.TransportWithMessageCredential);

            var factory = new WSTrustChannelFactory(binding, IDPAddress);

            //set up credetials
            factory.Credentials.UserName.UserName = "xxx";
            factory.Credentials.UserName.Password = "xxx123";
            factory.TrustVersion = TrustVersion.WSTrust13;

            //create token request
            var rst = new RequestSecurityToken
            {
                RequestType = RequestTypes.Issue,
                KeyType = KeyTypes.Symmetric,
                AppliesTo = new EndpointReference(ServiceAddress.AbsoluteUri)
            };

            return factory.CreateChannel().Issue(rst);

When I call Issue method I get error:

{"The requested service, 'https://domain:9988/issue/wstrust/mixed/username' 
could not be activated. See the server's diagnostic trace logs for more information."}

WCF service is accessible.

So I allow trace for IdentityServer 2, in wcfTrace.svclog I found this:

Exception:

Could not find a base address that matches scheme http for the endpoint with binding CertificateWSTrustBinding. Registered base address schemes are [https]. Stak Trace:

System.ServiceModel.ServiceHostBase.MakeAbsoluteUri(Uri relativeOrAbsoluteUri, Binding binding, UriSchemeKeyedCollection baseAddresses)
System.ServiceModel.ServiceHostBase.AddServiceEndpoint(String implementedContract, Binding binding, Uri address, Uri listenUri)
System.ServiceModel.ServiceHost.AddServiceEndpoint(Type implementedContract, Binding binding, Uri address, Uri listenUri)
System.ServiceModel.ServiceHost.AddServiceEndpoint(Type implementedContract, Binding binding, String address, Uri listenUri)
Thinktecture.IdentityServer.Protocols.WSTrust.TokenServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity)
System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath, EventTraceActivity eventTraceActivity)
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
System.ServiceModel.AspNetPartialTrustHelpers.PartialTrustInvoke(ContextCallback callback, Object state)
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequestWithFlow(Object state)
System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

I am confure because I code I don’t use never CertificateWSTrustBinding only ws2007FederationHttpBinding.

EDITED:

I think this is root of problem when I hit https://domain:9988/issue/wstrust/ I get generic WCF error:

Could not find a base address that matches scheme http for the endpoint with binding CertificateWSTrustBinding. Registered base address schemes are [https].

Stack Trace:

[InvalidOperationException: Could not find a base address that matches scheme http for the endpoint with binding CertificateWSTrustBinding. Registered base address schemes are [https].]
   System.ServiceModel.ServiceHostBase.MakeAbsoluteUri(Uri relativeOrAbsoluteUri, Binding binding, UriSchemeKeyedCollection baseAddresses) +8514770
   System.ServiceModel.ServiceHostBase.AddServiceEndpoint(String implementedContract, Binding binding, Uri address, Uri listenUri) +114
   System.ServiceModel.ServiceHost.AddServiceEndpoint(Type implementedContract, Binding binding, Uri address, Uri listenUri) +172
   System.ServiceModel.ServiceHost.AddServiceEndpoint(Type implementedContract, Binding binding, String address, Uri listenUri) +97
   Thinktecture.IdentityServer.Protocols.WSTrust.TokenServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +832
   System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +1961
   System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) +66
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +740

[ServiceActivationException: The service '/issue/wstrust' cannot be activated due to an exception during compilation.  The exception message is: Could not find a base address that matches scheme http for the endpoint with binding CertificateWSTrustBinding. Registered base address schemes are [https]..]
   System.Runtime.AsyncResult.End(IAsyncResult result) +466
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +241
   System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +184

What is wrong?