InArticleFor example, how to use svconfigeditor.exe to edit the WCF Service configuration file (1) describes how to use this tool for simple configuration to publish a WCF Service.
This article will continue to introduce the configuration of some advanced behaviors such as design certificates, binding behaviors, and service behaviors.
1. Configure the base address
If the WCF Service is published through serviehost, you must configure a base address for it. Of course, if the service is carried through IIS, there will be no base address.
The process is as follows:
Press Services-> select servicetype-> select host, and click New... button in the lower right corner. The base address editor dialog box is displayed, and enter base address, as shown in.
As mentioned earlier, there are many base address schemas, such as HTTP, https, and net. TCP, net. MSMQ, net. pipe. We need to select the appropriate base address Schema Based on the endpoint binding protocol. net. TCP //..., for such base address, the base address can be matched only when the endpoint uses the binding protocol nettcpbinding.
2. Service Behavior settings (including advanced settings such as authentication, authorization, and metadata)
(For the configuration of servicebehavior and the role of each element, please refer to the following KB articles:
Http://msdn.microsoft.com/en-us/library/ms788988.aspx)
Service bebaviors is the key and difficulty in the configuration file, which involves many complex functions. The following describes them one by one.
Press advanced-> Select Service behaviors-> click New Service Behavior configuration on the right to bring up the behavior screen. The default servicebevior name is newbehabior. We can rename it as you like, such as myservicebehavior, as shown in:
Click Add to add the servicebehavior element. The element in servicebevior is the focus. servivebehavior is like a iner. The element in it is the real treasure. the pop-up dialog box is as follows:
The red box contains the elements to be configured.
2.1 configure servicecredentials
After adding servicecredentials, click to enter. We can see the element set as shown in.
2.1.1 servicecertificate Element
Servicecertificate:
Specify an X.509 Certificate that will be used to authenticate the service to clients using message security mode. (For more details, please refer to: http://msdn.microsoft.com/en-us/library/ms731340.aspx)
The screenshot for editing this element in svcconfigeditor is as follows:
All attributes of servicecertificate
Attributes
| Attribute |
Description |
|
Findvalue |
A string that contains the value to search for in the X.509 certificate store. The type contained in the attribute must satisfy the requirements of the specified x509findtype. The default is an empty string. |
|
storelocation |
specifies the location of the X.509 certificate store that the client uses to validate the server's certificate against. Valid values include the following:
- localmachine: The certificate store assigned to the local machine.
- currentuser: The certificate store assigned to the current user.
the default is localmachine.
this value is used to specify the locations where the X.509 Certificate is stored on the server when the client verifies the server certificate. There are two values: localmachine and currentuser, the default value is localmachine. |
|
storename |
specifies the name of the X.509 certificate store to open. Valid values include the following:
- addressbook: certificate store for other users.
- authroot: certificate store for third-party Certificate Authorities (CAS).
- certificateauthority: certificate store for intermediate Certificate Authorities (CAS).
- disallowed: certificate store for Revoked Certificates.
- my: certificate store for personal certificates.
- root: certificate store for Trusted Root Certificate Authorities (CAS).
- trustedpeople: certificate store for directly trusted people and resources.
- trustedpublisher: certificate store for directly trusted publishers.
the default is my.
this value is used to specify the name of the storage location of the X.509 Certificate. The default value is my, that is, personal certificates. You can use MMC snap in (certificates) to view the storage location name of the certificate, which is:
|
|
X509findtype |
Defines the type of X.509 search to be executed. Valid values include the following:
- Findbythumbprint
- Findbysubjectname
- Findbysubjectdistinguishedname
- Findbyissuername
- Findbyissuerdistinguishedname
- Findbyserialnumber
- Findbytimevalid
- Findbytimenotyetvalid
- Findbytemplatename
- Findbyapplicationpolicy
- Findbycertificatepolicy
- Findbyextension
- Findbykeyusage
- Findbysubjectkeyidentifier
The type contained inFindvalueAttribute must satisfy the requirements of the specified x509findtype.
The default value is findbysubjectdistinguishedname.
This value specifies the search type used to search for X.509 certificates. By default, the value is findbysubjectdistinguishedname. |
2.1.2 clientcertificate Element
Defines an X.509 certificate used to sign and encrypt messages to a client form a service in a duplex communication pattern. (For more information, please refer to http://msdn.microsoft.com/en-us/library/ms731367.aspx ). and there are two elements in it, they are authentication and certificate.
The clientcertificate configuration screenshot is as follows:
Clientcertificate-> authentication configuration in the upper right, And clientcertificate-> certificate configuration in the lower right.
2.1.2.1 clientcertificate-> Authentication
Specifies authentication behaviors for client certificates used by a service. (specify the authentication behavior of the client certificate used by the Service)
Attributes
| Attribute |
Description |
|
Customcertificatevalidatortype |
Optional string. A type and Assembly used to validate a custom type. This attribute must be set whenCertificatevalidationmodeIs setCustom.
Optional string. Used to verify the type andProgramSet. WhenCertificatevalidationmodeSetCustomThis attribute must be set. |
|
Certificatevalidationmode |
Optional enumeration. Specifies one of three modes used to validate credentials. If setCustom, ThenCustomcertificatevalidatorMust also be supplied. The default isChaintrust.
Optional enumeration. One of the three modes used to verify creden. If it is setCustom, You must also provideCustomcertificatevalidator. The default value isChaintrust. |
|
Includewindowsgroups |
Optional Boolean. Specifies if windows groups are supported in the security context. setting this attributeTrueHas a performance impact, as it results in a full group expansion. Set this attributeFalseIf you do not need to establish the list of groups a user belongs.
Optional Boolean value. Specifies whether the Windows group is included in the security context. Set this propertyTrueThis will affect the performance because it will lead to full group expansion. If you do not need to create a list of user groups, set this attributeFalse. |
|
Mapclientcertificatetowindowsacccount |
Boolean. specifies whether the client can be mapped to a Windows identity using the certificate. Active Directory must be enabled to do this. For more information about using the Active Directory feature, see http://technet2.microsoft.com/WindowsServer/en/Library/0602148e-1a8f-4917-bb01-6fd342aba7161033.mspx.
Boolean value. Specifies whether the certificate can be used to map the client to a Windows identity. To do this, you must enable Active Directory. For more information about using the Active Directory function, see. |
|
Revocationmode |
Optional enumeration. One of the modes used to check for a revoked certificate lists (RCL). The default isOnline.
Optional enumeration. A mode used to check the revocation certificate list (RCL. The default value isOnline. |
|
Trustedstorelocation |
Optional enumeration. One of the two system store locations:LocalmachineOrCurrentuser. This value is used when a service certificate is negotiated to the client. validation is already med againstTrusted peopleStore in the specified store location. The default isCurrentuser.
Optional enumeration. One of the two system storage locations:LocalmachineOrCurrentuser. This value is used when you negotiate a service certificate with the client. Based on"Trusted person"Store for verification. The default value isCurrentuser. |
2.1.2.2 <clientcertificate>-> <certificate>
Specifies an X.509 certificate used to sign and encrypt messages. specifies the X.509 certificate used to sign and encrypt messages.
| Attribute |
Description |
|
Findvalue |
A string that contains the value to search for in the X.509 certificate store. The type contained in the attribute must satisfy the requirements of the specified x509findtype. The default is an empty string. |
|
Storelocation |
Specifies the location of the X.509 certificate store that the client uses to validate the server's certificate against. Valid values include the following:
- Localmachine: The certificate store assigned to the local machine.
- Currentuser: The certificate store assigned to the current user.
The default is localmachine. |
|
storename |
specifies the name of the X.509 certificate store to open. Valid values include the following:
- addressbook: certificate store for other users.
- authroot: certificate store for third-party Certificate Authorities (CAS).
- certificateauthority: certificate store for intermediate Certificate Authorities (CAS).
- disallowed: certificate store for Revoked Certificates.
- my: certificate store for personal certificates.
- root: certificate store for Trusted Root Certificate Authorities (CAS).
- trustedpeople: certificate store for directly trusted people and resources.
- trustedpublisher: certificate store for directly trusted publishers.
the default is my. |
|
X509findtype |
Defines the type of X.509 search to be executed. Valid values include the following:
- Findbythumbprint
- Findbysubjectname
- Findbysubjectdistinguishedname
- Findbyissuername
- Findbyissuerdistinguishedname
- Findbyserialnumber
- Findbytimevalid
- Findbytimenotyetvalid
- Findbytemplatename
- Findbyapplicationpolicy
- Findbycertificatepolicy
- Findbyextension
- Findbykeyusage
- Findbysubjectkeyidentifier
The type contained inFindvalueAttribute must satisfy the requirements of the specified x509findtype.
The default value is findbysubjectdistinguishedname. |