У меня есть сервис. Файл конфигурации такой:
XML |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
| <?xml version="1.0"?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="S.Binding">
<security mode ="Message">
<message clientCredentialType="Certificate"/>
</security>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="S.Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceCredentials>
<clientCertificate>
<authentication certificateValidationMode="Custom" mapClientCertificateToWindowsAccount="false" customCertificateValidatorType="NiceService.MyX509CertificateValidator, NiceService"/>
</clientCertificate>
<serviceCertificate findValue="44 4a e0 84 a7 86 ea 5b ff 26 3a 45 79 03 96 3b 2a 67 4e 2d" storeLocation="LocalMachine" storeName="My" x509FindType="FindByThumbprint"/>
</serviceCredentials>
<serviceAuthenticationManager serviceAuthenticationManagerType="NiceService.ServiceAuthenticationManagerTest, NiceService"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="NiceService.Service1" behaviorConfiguration="S.Behavior">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="S.Binding" contract="NiceService.IService1"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
<system.web>
<compilation debug="true"/>
</system.web>
</configuration> |
|
Правильно ли я понимаю, что это сервис с аутентификацией на основе сертификатов?
Зачем еще одна аутентификация, вот эта?
XML |
1
| <serviceAuthenticationManager serviceAuthenticationManagerType="NiceService.ServiceAuthenticationManagerTest, NiceService"/> |
|
И еще мне нужно добавить туда сессии. Для этого перед контрактом я добавил такой атрибут :
C# |
1
| [ServiceContract(SessionMode=SessionMode.Required)] |
|
И перед классом, релизующим контракт, вот такой :
XML |
1
| [ServiceBehavior(InstanceContextMode=InstanceContextMode.PerSession)] |
|
Все ли верно я сделал для того, чтобы сессии работали?