使用'GET'的wcf服务和使用'POST'的500错误

时间:2011-02-26 20:22:17

标签: wcf

我有一个wcf服务,如果我使用get,它运行良好 当我使用post it显示

System.ServiceModel.ServiceActivationException status 500

任何想法都是错误的吗?

这是代码

function Login(e) { 
debugger; 
e.preventDefault();
//getting mail 

var loginmail = 
$("[id$='txtLoginEmail']").val(); 

//getting password

var loginpassword = 
$("[id$='txtLoginPassword']").val(); 

//getting remember me checkbox

var checked = 
($("[id$='chkRememberme']").is(':checked')); 


var proxy = new _AppProxy('MemberService/Login', '', 'xml', 'POST', '', { mail: loginmail, password: 
loginpassword, rememberMe: checked }); 

proxy.Invoke();

};


[OperationContract] 
[WebInvoke(ResponseFormat = 
WebMessageFormat.Xml,Method="POST")] 

public string Login(string mail , string password , 
bool rememberMe) 
{

}

<system.serviceModel> 

<standardEndpoints> 

<webHttpEndpoint> 

<standardEndpoint 
name="" 
helpEnabled="true" 
automaticFormatSelectionEnabled="true" /> 

</webHttpEndpoint> 
</standardEndpoints>  
serviceHostingEnvironment 
aspNetCompatibilityEnabled="true" 
multipleSiteBindingsEnabled="true" > 

</serviceHostingEnvironment> 

</system.serviceModel>

1 个答案:

答案 0 :(得分:1)

可能是您错过了在WebService的URI中结尾的.svc。如果MemberService是服务的名称,Login是Method的名称,

MemberService.svc/Login