Я хочу использовать Spring.Net с включенными в Silverlight службами WCF. Я создал сервис "User.svc" и настроил его для работы с Spring.Net, я получил эти ошибки:
Ошибка сервера в «/» приложении.
-------------------------------------------------- ------------------------------
Composition proxy target must implement at least one interface.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more
информация об ошибке и ее возникновении в коде.
Exception Details: System.ArgumentException: Composition proxy target must implement at least one interface.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of
исключение можно определить, используя трассировку стека исключений ниже.
Не могли бы вы мне помочь? Все связанные файлы перечислены ниже.
User.svc
<%@ ServiceHost Language="C#" Debug="true" Service="Client.Web.WCFServices.User" CodeBehind="User.svc.cs" Factory="Spring.ServiceModel.Activation.ServiceHostFactory" %>
User.svc.cs
[SilverlightFaultBehavior]
[ServiceContract(Namespace = "http://Client.Web")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class User
{
private string testdi = "abc";
[OperationContract]
public string Hello(string msg)
{
return msg;
}
[OperationContract]
public int GetUserFromFingerprint(string fpt)
{
return 1;
}
[OperationContract]
public string HelloSpring(string msg)
{
UserDao ud = new UserDao();
Entities.User u = new Entities.User();
u.Password = "abc";
u.Group = new Entities.Group();
ud.Save(u);
return this.testdi;
}
}
Файл конфигурации Spring.net
<object id="UserServiceHost" type="Spring.ServiceModel.Activation.ServiceHostFactoryObject, Spring.Services">
<property name="TargetName" value="UserService" />
</object>
<object id="UserService" singleton="false" type="Client.Web.WCFServices.User, Client.Web">
<property name="testdi" value="qwe" />
</object>
Web.config
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<customBinding>
<binding name="Client.Web.WCFServices.User.customBinding0">
<binaryMessageEncoding />
<httpTransport />
</binding>
</customBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<services>
<service name="UserService">
<endpoint address="" binding="customBinding" bindingConfiguration="Client.Web.WCFServices.User.customBinding0"
contract="Client.Web.WCFServices.User" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>