非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

posted @ 2015-01-29 19:58  lxdonge  阅读(221)  评论(0)    收藏  举报