假设我有一个 wcf 服务 web 配置文件。
<bindings>
<webHttpBinding>
<!-- if you cross domain,here is necessary-->
<binding name="MyAjaxBind" crossDomainScriptAccessEnabled="true" />
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="WebApplication2.Service1AspNetAjaxBehavior">
<!-- here is necessary-->
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors >
<behavior name="MyServiceTypeBehaviors" >
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<!-- here is necessary-->
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<services>
<service name="WcfService1.Service1" behaviorConfiguration="MyServiceTypeBehaviors">
<endpoint address="" behaviorConfiguration="WebApplication2.Service1AspNetAjaxBehavior"
binding="webHttpBinding" bindingConfiguration="MyAjaxBind" contract="WcfService1.IService" />
</service>
</services>
例如:
<binding name="MyAjaxBind"
“MyAjaxBind”是一个随机名称还是有一些含义?和
<behavior name="MyServiceTypeBehaviors" >
MyServiceTypeBehaviors 是随机名称还是与项目名称有某些含义?
编辑: 另外我想知道我是否有内部无文件激活的代码,那么应该改变什么?
<serviceActivations>
<add service="service.wservice"
relativeAddress="wscccService.svc"
factory="System.ServiceModel.Activation.WebServiceHostFactory"
/>
</serviceActivations>