我知道webservicehost类上的身份验证不完全符合身份验证标准(返回403forbidden而不是在用户输入不正确的凭据时提示输入另一组凭据)。我仍然希望实现这种基本身份验证(在session开始时使用用户名和密码,不需要HTTPS-见下图),因为它适合我对小型家庭项目的需求。myService的代码如下:ImportsSystem.IOImportsSystem.TextImportsSystem.ServiceModelImportsSystem.ServiceModel.WebImportsSystem.ServiceModel.ChannelsPublicClassmy