I learned how to solve this problem. I made it using EditWcfConfiguration tool in visual studio 2012 as explained below.
Firstly, set property of 'SSL Enabled' as true in host project properties. Under this property automatically ssl url will be generated(such as 'https://localhost:44300/
') Then, right click host project and select properties. In project properties Web tab, check 'Use Local IIS Web server' then check 'Use IIS Express'
-- In host project WebConfig, right click then select EditWcfConfiguration:
In EditWcfConfiguration firstly add service, then add a binding for endpoint of service, then add a behavior for service.
1- Add Service
- Browse service type at host's bin folder
- Select communication mode as HTTP
- Select Advanced Web Service interoperability as Simplex communication
- Leave the address blank
- After adding behavior configuration; select BehaviorConfiguration
- After adding binding configuration; open end point of service then, select binding(customBinding) and bindingConfiguration
2- Add a custom binding
- Rename binding to use in service's BehaviorConfiguration property (such as 'custom_binding').
- Add security, httpsTransport tags.
- Select 'AuthenticationMode' as 'UserNameOverTransport' under security tag.
3- In Advanced/Service Behaviors folder, add new service behavior configuration
- Rename behavior to use in service end point's BindingConfiguration property (such as safe_behavior).
- Add serviceCredentials, serviceMetadata, serviceDebug tags.
For serviceCredentials tag properties:
a-) Select customUserNamePasswordValidatorType as your validator class and its namespace (such as: 'Rids.WcfHost.ServiceUserValidator, Rids.WcfHost')
b-) Select userNamePasswordValidationMode as custom
For clientCertificate tag(under serviceCredentials tag) properties, select certificateValidationMode as None and revocationMode as NoCheck
- For serviceMetadata tag properties set HttpsGetEnabled as True
- For serviceDebug tag properties set includeExceptionDetailInFaults as True
After these steps, resulting service model is:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="safe_behavior">
<serviceCredentials>
<clientCertificate>
<authentication certificateValidationMode="None" revocationMode="NoCheck" />
</clientCertificate>
<userNameAuthentication userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="Rids.WcfHost.ServiceUserValidator, Rids.WcfHost" />
</serviceCredentials>
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="custom_binding">
<security authenticationMode="UserNameOverTransport" />
<httpsTransport />
</binding>
</customBinding>
</bindings>
<services>
<service behaviorConfiguration="safe_behavior" name="Rids.Services.Services.SurveyService">
<endpoint address="" binding="customBinding"
bindingConfiguration="custom_binding" contract="Rids.Services.Services.ISurveyService" />
</service>
</services>
</system.serviceModel>