! , , , Reflector. , , , .
-: MultipleBaseAddressBasicHttpBindingServiceHostFactory MultipleBaseAddressBasicHttpBindingServiceHost; WebScriptServiceHostFactory WebScriptServiceHost.
System.ServiceModel.ServiceHost, . , , , .
, , . OnOpening().
WebScriptServiceHost :
base.OnOpening();
WebServiceHost.AddAutomaticWebHttpBindingEndpoints(
this,
base.ImplementedContracts,
SR2.GetString(SR2.JsonWebScriptServiceHostOneServiceContract, base.ImplementedContracts.Count));
foreach (ServiceEndpoint endpoint in base.Description.Endpoints)
{
if (endpoint.Binding != null &&
endpoint.Binding.CreateBindingElements().Find<WebMessageEncodingBindingElement>() != null &&
endpoint.Behaviors.Find<WebHttpBehavior>() == null)
{
endpoint.Behaviors.Add(new WebScriptEnablingBehavior());
}
}
, , endpoint.Behaviors.Add(new WebScriptEnablingBehavior());, URL (/js), .
, MultipleBaseAddressBasicHttpBindingServiceHost, ():
ClientServiceHost host = ClientServiceHost.CreateServiceHost();
this.CreateEndpoints();
base.OnOpening();
host.OnServiceHostOpeningInternal(this);
WebServiceHost.AddAutomaticWebHttpBindingEndpoints() this.CreateEndpoints() . , SharePoint .
ClientServiceHost.CreateServiceHost() - factory, ClientServiceHost , web.config microsoft.sharepoint.client/serverRuntime.
OnServiceHostOpeningInternal() OnServiceHostOpening(). web.config , , :
<serverRuntime>
<hostTypes>
<add type="Microsoft.SharePoint.Client.SPClientServiceHost, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
</hostTypes>
</serverRuntime>
, . OnServiceHostOpening() :
[SharePointPermission(SecurityAction.Demand, ObjectModel=true)]
protected override void OnServiceHostOpening(ServiceHost serviceHost)
{
if (serviceHost != null)
{
SPUtility.ConfigServiceHostIfClaimsAuth(serviceHost);
}
}
, , .
! , . , WebScriptServiceHost .
, . , , WebScriptServiceHost . , , factory, Microsoft, , /js endpoint.Behaviors.Add(new WebScriptEnablingBehavior(). , , - . , , SP- factory, .
, .