我正在尝试创建一个自定义ASP.NET使用WCF形成身份验证服务。我通过一个只包含一行JS的测试页面调用它(除了ScriptManager脚本)。问题是服务器返回响应代码500,而响应主体为空。我在服务方法和应用程序中的断点出错全球.asax没有被击中。
Sys.Services.AuthenticationService.login('user', 'pass', false, null, null, null, null, null);
{"userName":"user","password":"pass","createPersistentCookie":false}
请求方的其他事情似乎也不错。
以下是配置服务:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="BtxAuthenticationEndpointBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
</serviceBehaviors>
</behaviors>
<services>
<service name="MyNamespace.BtxAuthenticationService">
<endpoint contract="MyNamespace.IBtxAuthenticationService" binding="webHttpBinding" behaviorConfiguration="BtxAuthenticationEndpointBehavior"/>
</service>
</services>
</system.serviceModel>
以及接口声明:
[ServiceContract]
public interface IBtxAuthenticationService
{
[OperationContract]
[WebInvoke]
bool Login(string username, string password, bool createPersistentCookie);
[OperationContract]
[WebInvoke]
void Logout();
}
public class BtxAuthenticationService : IBtxAuthenticationService
{
public bool Login(string username, string password, bool createPersistentCookie)
{
... irrelevant because this is never hit
}
public void Logout()
{
}
}
有人能告诉我如何配置这个或者给我指出一种调试它的方法吗。一篇关于用WCF服务实现自定义表单身份验证的文章也将受到欢迎。我尝试过各种其他设置,包括我能找到的所有异常详细信息设置,但没有取得任何进展(尽管我能够进行一些回归,并得到不同的异常,如缺少端点等等)。
谢谢你抽出时间。