非IIS作为宿主的wcf被ajax调用
1.在配置文件,app.config中添加一个节点
<behaviors> <endpointBehaviors > <behavior name ="MyBehavior"> <enableWebScript/> < behavior> <endpointBehaviors>
2. 添加endpoint的绑定
<endpoint address="http://localhost:9418/CaculatorService" binding="webHttpBinding" bindingConfiguration="" contract="Contracts.ICalculator" behaviorConfiguration ="MyBehavior"/>
绑定必须为webHttpBinding