Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/475.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用WebScriptEndpoint使用javascript使用WCF服务_Javascript_Wcf_Html - Fatal编程技术网

使用WebScriptEndpoint使用javascript使用WCF服务

使用WebScriptEndpoint使用javascript使用WCF服务,javascript,wcf,html,Javascript,Wcf,Html,我在网上搜索过,但没有找到任何合适的文章解释如何使用javascript使用WCF服务,尤其是WebScriptEndpoint 有人能对这件事指点一下吗 谢谢这是一篇关于REST服务的好文章: 总之,您需要使用webHttpBinding配置端点。 此终结点应具有启用webHttp的行为: <services> <service name="TestService"> <endpoint address="test" binding="webHttpB

我在网上搜索过,但没有找到任何合适的文章解释如何使用javascript使用WCF服务,尤其是WebScriptEndpoint

有人能对这件事指点一下吗


谢谢

这是一篇关于REST服务的好文章:

总之,您需要使用webHttpBinding配置端点。 此终结点应具有启用webHttp的行为:

<services>
  <service name="TestService">
    <endpoint address="test" binding="webHttpBinding"  behaviorConfiguration="restBehavior" contract="ITestService"/>
  </service>
</services>

您可以使用WebGet或WebInvoke属性(取决于您想获取还是发布).

这是一篇关于REST服务的好文章:

总之,您需要使用webHttpBinding配置端点。 此终结点应具有启用webHttp的行为:

<services>
  <service name="TestService">
    <endpoint address="test" binding="webHttpBinding"  behaviorConfiguration="restBehavior" contract="ITestService"/>
  </service>
</services>

您可以使用WebGet或WebInvoke属性(取决于您是否要获取或发布).

“在编写从ASP.NET AJAX应用程序调用的服务时,请使用[WebScriptEndpoint]。你确定这就是你想要的吗?谢谢CodeCaster编辑我的问题:)@CodeCaster我不能使用脚本管理器等,没有ASP.net。想要使用我的纯HTML5页面上的服务,我找到了一个简单的示例。WCF随附的WCF示例中是否没有—请参见此处,为什么不简单地实现basicHttpBinding并从HTML/javascript对其执行SOAP调用?“当您编写从ASP.NET AJAX应用程序调用的服务时,请使用[WebScriptEndpoint]。你确定这就是你想要的吗?谢谢CodeCaster编辑我的问题:)@CodeCaster我不能使用脚本管理器等,没有ASP.net。想要使用我的纯HTML5页面上的服务,我找到了一个简单的示例。WCF附带的WCF示例中没有一个—请看这里,为什么不简单地实现basicHttpBinding并从HTML/javascript对其执行SOAP调用呢?
[ServiceContract]
public interface ITestService
{
    [OperationContract]
    [WebGet(UriTemplate = "test?p={p}", ResponseFormat = WebMessageFormat.Json)]
    string Test(string p);
}