【发布时间】:2011-05-16 11:25:06
【问题描述】:
我创建了一个空白 Web 应用程序并添加了一个启用 ajax 的 wcf 服务。 我没有修改我使用的模板提供的实际 svc.cs 文件
namespace SP.WebWCF {
[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class ActivateCardV1 {
// To use HTTP GET, add [WebGet] attribute. (Default ResponseFormat is WebMessageFormat.Json)
// To create an operation that returns XML,
// add [WebGet(ResponseFormat=WebMessageFormat.Xml)],
// and include the following line in the operation body:
// WebOperationContext.Current.OutgoingResponse.ContentType = "text/xml";
[OperationContract]
public void DoWork() {
// Add your operation implementation here
return;
}
// Add more operations here and mark them with [OperationContract]
}
}
我已经稍微更新了配置,看起来像这样
<service name="SP.WebWCF.ActivateCardV1">
<endpoint address="https://services.mydomain.com" behaviorConfiguration="SP.WebWCF.ActivateCardV1AspNetAjaxBehavior"
binding="webHttpBinding" contract="SP.WebWCF.ActivateCardV1" listenUri="/" isSystemEndpoint="true" />
</service>
但是,当我尝试点击服务时,我得到了一个错误
服务“SP.WebWCF.ActivateCardV1”的应用程序(非基础设施)端点为零。这可能是因为找不到您的应用程序的配置文件,或者因为在配置文件中找不到与服务名称匹配的服务元素,或者因为在服务元素中没有定义端点。
我做错了什么?
【问题讨论】:
标签: .net wcf exception-handling asp.net-ajax wcf-endpoint