Yes, I have httpsGetEnabled=true.
On the service side:
<behaviors>
<serviceBehaviors>
<behavior name="SecuredBehaviour">
<serviceMetadata httpsGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="SecuredBehaviour"
name="KOM1secured.UserServices">
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="SecuredBinding"
name="UserServices.Http"
contract="KOM1secured.IUserServices" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="SecuredBinding">
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
If I run this on the client:
BasicHttpBinding basicHttpBinding = new BasicHttpBinding();
EndpointAddress endpointAddress = new EndpointAddress("https://1.2.3.4/UserServices.svc");
IUserServices userServices = new ChannelFactory<IUserServices>(basicHttpBinding, endpointAddress).CreateChannel();
I get the message about expecting http and not https. I then tried to change the Web.Config on the client side, adding this:
<bindings>
<basicHttpBinding>
<binding name="UserServices.Http">
<security mode="Transport">
<transport clientCredentialType="None"
proxyCredentialType="None"
realm="" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://1.2.3.4/UserServices.svc"
binding="basicHttpBinding"
bindingConfiguration="UserServices.Http"
contract="KOM1secured.Client.IUserServices"
name="UserServices.Http" />
</client>
- and then changing the binding declaration to HttpBinding httpBinding = new HttpBinding("UserServices.http") ...but from that I get the error shown in the bottom of this.
Tough! Any ideas?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
System.ServiceModel.ProtocolException: The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
</title><link href="StyleSheet.css" rel="stylesheet" type="text/css" />
<style type="text/css">
</style>
</head>
<body>
<form name="aspnetForm" method="post" action="login.aspx?ReturnUrl=%2fUserServices.svc" id="aspnetForm">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNjI0NjkyNzcyZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18WAwUQY3RsMDAkaW1nQnRuTG9nbwUrY3RsMDAkQ29udGVudFBsYWNlSG9sZGVyNCRMb2dpbjEkUmVtZW1iZXJNZQUxY3RsMDAkQ29udGVudFBsYWNlSG9sZGVyNCRMb2dpbjEkTG9naW5JbWFnZUJ1dHRvbrGiS5hvsUnIQF/fmQ1auH4P9Tpa" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWCgK6sKK+AwLQ7uz5DAK97MusCQK1suXbDgKstd38AQLN5o2oCQL63fDxDQLh97PgDgKAjNJ7AseCl44FP/qmqhoQ/hjQLZHyTaAa3EL7U88=" />
<div class="header">
<div class="headerLogo">
<input'.
Server stack trace:
at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at KOM1secured.IUserServices.CreateUserASP(String _username, String _password, String _email)
at KOM1_web_services.GeneralData.CreateUserASP() in C:\Users\Anders\Documents\Visual Studio 2008\Projects\kom1 (2)\KOM1 web services\App_Code\GeneralData.cs:line 26
at KOM1_web_services.UserControl.CreateUserASP() in C:\Users\Anders\Documents\Visual Studio 2008\Projects\kom1 (2)\KOM1 web services\UserControl.asmx.cs:line 50