J'ai quelque chose comme ça:
<system.serviceModel>
<services>
<service behaviorConfiguration="defaultServiceBehavior" name="MathServiceLibrary.MathService">
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<endpoint address="" binding="wsHttpBinding" contract="MathServiceLibrary.IMathService">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="defaultServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
4 Réponses :
Changer votre MS.SVC comme ci-dessous
<%@ ServiceHost Language="C#" Debug="true" Service="MathServiceLibrary.MathService" % >
Votre fichier .svc est faux. Il fait référence à l'interface, pas à la mise en œuvre. Changez-le à ceci:
<% @ ServiceHost Langue = "C #" Débug = "TRUE" Service = "MathServicelibrary.MathService"%> P> P> P>
J'ai eu ma mise en œuvre sur un autre projet, pas dans la même espace de noms, y a-t-il un problème?
Le fichier SVC doit avoir le nom de la classe plutôt que le nom de l'interface. Un exemple de fichier SVC a le contenu ci-dessous:
<%@ ServiceHost Language="C#" Debug="true" Service="SampleService.Service1" CodeBehind="Service1.svc.cs" %>
L'entrée dans votre fichier SVC est incorrecte:
au lieu de: p> Vous devez avoir: p> Vous devez définir la classe d'implémentation de service SERVICE = CODE> Attribut - pas strong> Le contrat de service! P> P> P> >