hi
pleas help me
i have a project silverlight,wcf service
i take it error:The service class of type prjManomoshaver.Web.Service1 both defines a ServiceContract and inherits a ServiceContract from type System.Data.Services.IRequestHandler. Contract inheritance can only be used among interface types. If a class is marked with ServiceContractAttribute, it must be the only type in the hierarchy with ServiceContractAttribute. Consider moving the ServiceContractAttribute on type System.Data.Services.IRequestHandler to a separate interface that type System.Data.Services.IRequestHandler implements
this is code service:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceContract(Namespace = "")]
[ServiceBehaviorAttribute(InstanceContextMode=InstanceContextMode.PerCall)]
public class Service1 : DataService<BankDataContext>,IRequestHandler
{
public static void InitializeService(DataServiceConfiguration config)
{
config.UseVerboseErrors = true;
config.SetEntitySetAccessRule("MySocket", EntitySetRights.All);
config.SetServiceOperationAccessRule("Connect", ServiceOperationRights.All);
config.SetServiceOperationAccessRule("Accept", ServiceOperationRights.All);
config.SetServiceOperationAccessRule("Receive", ServiceOperationRights.All);
config.SetServiceOperationAccessRule("Send", ServiceOperationRights.All);
config.SetServiceOperationAccessRule("Close_Connect", ServiceOperationRights.All);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
}
#region declare
public string strReceive = "";
public static Socket SocketReceive = null;
public static Socket SocketSender = null;
byte[] buffer = null;
byte[] sbuffer = null;
IPEndPoint serverSend = null;
IPEndPoint serverReceive = null;
public bool sensor_connect=false;
public bool sensor_send = false;
public bool sensor_receive = false;
public bool sensor_accept = false;
MySocket SocketAccept = null;
#endregion
#region connect
[OperationContract,WebGet]
public void Connect(string Ip, int Port)
{
try
{
Close_Connect(null);
serverSend = new IPEndPoint(IPAddress.Parse(Ip), Port);
SocketSender = new Socket(AddressFamily.InterNetwork, SocketType.Stream,ProtocolType.Tcp);
SocketSender.BeginConnect(serverSend,new AsyncCallback(ConnectCallBack),SocketSender);
}
catch
{
Close_Connect(null);
}
}
private void ConnectCallBack(IAsyncResult ar)
{
Socket worker = (Socket)ar.AsyncState;
Socket temp = worker;
try
{
sbuffer = new byte[1024];
worker.EndConnect(ar);
sensor_connect = true;
sbuffer = System.Text.UTF8Encoding.UTF8.GetBytes("Connect");
temp.BeginSend(sbuffer, 0, sbuffer.Length, SocketFlags.None, new AsyncCallback(SenderCallBack),temp);
}
catch
{
sensor_connect = false;
SocketAccept = new MySocket();
Close_Connect(SocketAccept);
}
}
and this is webconfig:
<!--
For more information on how to configure your ASP.NET application, please visit
http:
-->
<configuration>
<configsections>
<!-- For more information on Entity Framework configuration, visit http:
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirepermission="false" />
</configsections>
<connectionstrings>
<add name="manomoshaverConnectionString" connectionstring="Data Source=.;Initial Catalog=manomoshaver;Integrated Security=True" providername="System.Data.SqlClient" />
</connectionstrings>
<system.web>
<compilation debug="true" targetframework="4.0" />
</system.web>
<system.servicemodel>
<extensions>
<behaviorextensions>
<add name="silverlightFaults" type="prjManomoshaver.Web.SilverlightFaultBehavior, prjManomoshaver.Web" />
</behaviorextensions>
</extensions>
<behaviors>
<endpointbehaviors>
<behavior name="SilverlightFaultBehavior">
<!--<silverlightfaults />-->
</behavior>
</endpointbehaviors>
<servicebehaviors>
<behavior name="">
<servicemetadata httpgetenabled="false" />
<servicedebug includeexceptiondetailinfaults="true" />
</behavior>
</servicebehaviors>
</behaviors>
<bindings>
<custombinding>
<binding name="prjManomoshaver.Web.DataService.customBinding0">
<binarymessageencoding />
<context />
<httptransport />
</binding>
</custombinding>
</bindings>
<servicehostingenvironment aspnetcompatibilityenabled="true" multiplesitebindingsenabled="true" />
<services>
<service name="prjManomoshaver.Web.DataService">
<endpoint address="" binding="customBinding" bindingconfiguration="prjManomoshaver.Web.DataService.customBinding0" name="prjManomoshaver.Web.DataService.customBinding0" contract="prjManomoshaver.Web.DataService" behaviorconfiguration="SilverlightFaultBehavior" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.servicemodel>
<entityframework>
<defaultconnectionfactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultconnectionfactory>
</entityframework>
</configuration>