找不到服务端点

时间:2017-04-11 09:25:02

标签: c# ajax wcf sharepoint

我在生产辅助服务器中获得了以下WCF方法的服务端点未找到错误,但在主服务器中也是如此。

[OperationContract]
        [WebInvoke(Method = "POST",
                    BodyStyle = WebMessageBodyStyle.Wrapped,
                    RequestFormat = WebMessageFormat.Json,
                    ResponseFormat = WebMessageFormat.Json,
                    UriTemplate = "/Alerts/Information")]
        [FaultContract(typeof(Fault))]
        Message SetEmailAlertInfo(Stream emailAlertInfo);

的web.config

<system.serviceModel>
    <bindings>
      <webHttpBinding>
        <binding maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" name="webBinding">
          <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
          <security mode="Transport" />
        </binding>
      </webHttpBinding>
    </bindings>
    <services>
      <service name="TDM.Shared.Services.EmailAlertsService">
        <endpoint address="/Save" binding="webHttpBinding" bindingConfiguration="webBinding" contract="TDM.Shared.Services.IEmailAlertsService">
        </endpoint>
      </service>
    </services>
  </system.serviceModel>

AJAX致电

$.ajax({
                    type: 'POST', //set service type
                    url: "/_vti_bin/TDM.Portal.Services/EmailAlertsService.svc/Save/Alerts/Information", 
                    contentType: "application/x-www-form-urlencoded",
                    data: JSON.stringify(obj),
                    success: function (data) {
                    },
                    error: function (data) {

                    }
                });

如果我在ajax调用中更改URI,它会起作用。 /_vti_bin/TDM.Portal.Services/EmailAlertsService.svc/Alerts/Information

欣赏您宝贵的解决方案。

0 个答案:

没有答案