我坚持使用WCF。我一直在从javascript访问服务没问题,但现在我已经从ASP.NET访问我有很多问题。 Curretnly我收到标题中显示的错误。
不确定这是否是一个问题,但服务器是.net,客户端是.net 3.5。最初它完全正常工作,甚至不必在客户端的Web配置中放任何东西,不明白改变了什么。 ASMX页面非常简单!
提前感谢任何可以提供帮助的人。
我的服务器web.config是......
system.serviceModel>
<protocolMapping>
<add scheme="http" binding="webHttpBinding" bindingConfiguration="" />
</protocolMapping>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="EndpBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="PanacheLib.Services.Panache" behaviorConfiguration="ServiceBehavior">
<endpoint address="" behaviorConfiguration="EndpBehavior" binding="webHttpBinding" contract="PanacheLib.Services.IPanache" />
</service>
</services>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
我的客户web.config是......
<system.serviceModel>
<client>
<endpoint
name="default"
address="http://localhost/effect/PanacheSuperbraNew/services/Panache.svc"
binding="webHttpBinding"
contract="PanacheWcf.IPanache" behaviorConfiguration="webhttp"/>
</client>
<bindings>
<webHttpBinding>
<binding name="default" allowCookies="true" ></binding>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors >
<behavior name="webhttp" >
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
这是合同代码..
[ServiceContract(SessionMode=SessionMode.Allowed)]
public interface IPanache
{
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
EventCode SubmitReview(string name, int rangeId, string review, int fit, int app, int qal, int val);
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
EventCode<List<RangeReview>> GetRangeReviews(int rangeId);
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
EventCode<List<Retailer>> GetRetailers(string brands, string address, string country);
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
EventCode<List<OnlineRetailer>> GetOnlineRetailers(string brands, string country);
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
EventCode<Signup> Singup(string email);
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
EventCode<List<RetailerCountry>> GetRetailerCountries();
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
EventCode<List<string>> GetUKCounties(eBrand[] brands );
[OperationContract]
[WebInvoke(Method = "POST", BodyStyle = WebMessageBodyStyle.WrappedRequest, ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]
EventCode<List<Retailer>> GetRetailersOldSites(eBrand[] brands, decimal latitude, decimal longitude, int? country, bool onWeb, bool onStreat);
}