我是wcf的菜鸟,我需要一些帮助。
老实说,我对web.config文件了解不多,还有很多东西需要参考。
我有一个Service.svc.cs和一个IService.cs接口我想建立一个用户可以从客户端登录的登录系统。
//Service Contract
[ServiceContract]
public class ItheService
{
[OperationContract]
string Login(string email, string password);
}
//interface
public class TheService : ItheService
{
public string Login(string email, string password)
{
//some code
return "";
}
}
我阅读了很多页面,尝试了一些不同的web.config变体,并得到了需要会话的合同错误。
我知道我需要行为和服务设置,但我不知道该使用什么。
有人可以解释我需要在web.config文件中添加什么内容吗?
我最初有这个web.config,但我知道它错了。
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="httpBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
<service name="TheService.theService">
<endpoint address=""
behaviorConfiguration="httpBehavior"
binding="webHttpBinding"
contract="TheService.ItheService" />
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>