Bonjour,
J'ai crée un WCF service basique Hello World qui fonctionne parfaitement en local mais lorsque je le met en ligne chez OVH, il ne fonctionne plus et je n'arrive vraiment pas à trouver la solution, après plusieurs jours de recherche sur internet...
J'ai vraiment essayé beaucoup de choses et toujours la même erreur
LKservice.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace LK_WCFService
{
[ServiceContract]
public interface ILKService
{
[OperationContract]
[WebInvoke(
Method = "GET",
ResponseFormat = WebMessageFormat.Json,
UriTemplate = "json/{Name}")]
string SayHelloJson(string Name); |
LKService.svc.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Text;
namespace LK_WCFService
{
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class LKService : ILKService
{
public String SayHelloJson(string Name)
{
return "Hello " + Name;
} |
Web.config
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| <?xml version="1.0"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true"/>
</appSettings>
<!--
Pour obtenir une description des modifications de web.config, voir http://go.microsoft.com/fwlink/?LinkId=235367.
Les attributs suivants peuvent être définis dans la balise <httpRuntime>.
<system.Web>
<httpRuntime targetFramework="4.5.2" />
</system.Web>
-->
<system.web>
<compilation debug="true" targetFramework="4.5.2"/>
<httpRuntime targetFramework="4.5"/>
<customErrors mode="Off"/>
</system.web>
<system.serviceModel>
<services>
<service name="LK_WCFService.LKService">
<endpoint address="http://http://domaine.com/lk_wcfservice/lkservice.svc"
listenUri="/" binding="basicHttpBinding" contract="LK_WCFService.ILKService"></endpoint>
<endpoint behaviorConfiguration=" WebBehavior" binding="webHttpBinding"
bindingConfiguration="" contract="LK_WCFService.ILKService" />
<host>
<baseAddresses>
<add baseAddress="http://domaine.com/" />
</baseAddresses>
</host>
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="HttpBinding" maxReceivedMessageSize="2097152">
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name=" WebBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https"/>
</protocolMapping>
<!--<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>-->
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration> |
LKService.svc
<%@ ServiceHost Language="C#" Debug="true" Service="LK_WCFService.LKService" CodeBehind="LKService.svc.cs" %>
Merci d'avance pour vos réponses et votre temps....
Partager