add web Reference 输入地址:http://localhost:50759/mPageService.svc/updateMessageTemplateJson_POST?category=Nurse&name=news service&description='this is your news service&subject=wcf webservice&content=Hi zSong
游览器显示“不允许此方法。”,“下载“http://localhost:50759/mPageService.svc/updateMessageTemplateJson_POST?category=Nurse&name=news service&description='this is your news service&subject=wcf webservice&content=Hi zSong”时出错。
请求因 HTTP 状态 405 失败: Method Not Allowed。
There was an error downloading 'http://localhost:50759/mPageService”
以下是代码ISERVER与config的代码:
ImPageService.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Data;
5 using System.Runtime.Serialization;
6 using System.ServiceModel.Web;
7 using System.ServiceModel;
8 using System.Text;
9
10 namespace mPageService
11 {
12 // NOTE: If you change the interface name "ImPageService" here, you must also update the reference to "ImPageService" in Web.config.
13 [System.Web.Script.Services.ScriptService()]
14 [ServiceContract(Namespace = "", Name = "mPageService")]
15 public interface ImPageService
16 {
17 [OperationContract]
18 [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json)]
19 void updateMessageTemplateJson_POST(string category, string name, string description, string subject, string content);
20 }
web.config
<authentication mode="Forms" />
<system.serviceModel>
<services>
<service behaviorConfiguration="mPageService.mPageServiceBehavior" name="mPageService.mPageService">
<endpoint address="" binding="webHttpBinding" behaviorConfiguration="AjaxBehavior" contract="mPageService.ImPageService"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" listenUriMode="Explicit" />
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<behaviors>
<serviceBehaviors>
<behavior name="mPageService.mPageServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="AjaxBehavior">
<enableWebScript/> <!--<webHttp/>-->
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
希望哪位好心人帮我看呀,急急...
一般是地址错误了 点开wcf的那个help看看 http://url/help
从你的配置文件上来看,你这个是一个需要在客户端添加Scriptmanager控件来调用ajax的enabled- ajax - wcf wservice,这样的service是不能再客户端通过添加应用的方式调用的,具体的调用方法你可以参考一下这个link http://archive.cnblogs.com/a/1934492/