2016-12-20 2 views
0

J'ai développé un service Web REST dans WCF. Lorsque je consulte http://localhost:18349/SvcLipigas.svc, je vois la page d'accueil du service. Quand je charge http://localhost:18349/SvcLipigas.svc?wsdl je peux voir la définition, et ainsi de suite. Cependant, lorsque j'essaie d'exécuter une opération, j'obtiens l'erreur "Endpoint not found".Erreur "Endpoint not found" dans le service WCF lors de l'appel d'une opération

C'est le fichier SVC:

<%@ ServiceHost Language="C#" Debug="true" Service="WS_PedidoCliente.SvcLipigas" CodeBehind="SvcLipigas.svc.cs" %> 

Telle est la définition de la méthode:

[OperationContract] 
[WebInvoke(Method = "GET", 
    ResponseFormat = WebMessageFormat.Json, 
    BodyStyle = WebMessageBodyStyle.WrappedRequest, 
    UriTemplate = "AlmacenaPedido/{telefono}/{fechaPedido}/{horaPedido}/{codigoInterno}/{descripcionProducto}/{cantidadProducto}/{valorUnitario}/{kilosProducto}/{fechaEntrega}/{horaEntrega}/{fechaDespacho}/{horaDespacho}")] 
int AlmacenaPedido(string telefono, string fechaPedido, string horaPedido, string codigoInterno, string descripcionProducto, 
        string cantidadProducto, string valorUnitario, string kilosProducto, string fechaEntrega, string horaEntrega, 
        string fechaDespacho, string horaDespacho); 

Et enfin, voici le web.config:

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <configSections> 
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> 
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 
    </configSections> 
    <appSettings> 
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /> 
    </appSettings> 
    <system.web> 
    <compilation debug="true" targetFramework="4.5" /> 
    <httpRuntime targetFramework="4.5" /> 
    </system.web> 
    <system.serviceModel> 
    <services> 
    <service name="WS_PedidoCliente.SvcLipigas" behaviorConfiguration="serviceBehavior"> 
     <endpoint address="" 
       binding="webHttpBinding" 
       contract="WS_PedidoCliente.ISvcLipigas" 
       bindingNamespace="http://ws.lipigas.cl" 
       behaviorConfiguration="web"></endpoint> 
      </service> 
    </services>  
    <behaviors> 
     <serviceBehaviors> 
     <behavior name="serviceBehavior"> 
      <!-- To avoid disclosing metadata information, set the values below to false before deployment --> 
      <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="false" /> 
     </behavior> 
     </serviceBehaviors> 
     <endpointBehaviors> 
     <behavior name="web"> 
      <webHttp /> 
     </behavior> 
     </endpointBehaviors>  
    </behaviors> 
    <protocolMapping> 
     <add binding="basicHttpsBinding" scheme="https" /> 
    </protocolMapping> 
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
    <system.webServer> 
    <modules runAllManagedModulesForAllRequests="true" /> 
    <!-- 
     To browse web app root directory during debugging, set the value below to true. 
     Set to false before deployment to avoid disclosing web app folder information. 
     --> 
    <directoryBrowse enabled="true" /> 
    </system.webServer> 
    <entityFramework> 
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> 
     <parameters> 
     <parameter value="v12.0" /> 
     </parameters> 
    </defaultConnectionFactory> 
    </entityFramework> 
    <connectionStrings> 
    <add name="LipigasEntities" connectionString="metadata=res://*/Model.Lipigas.csdl|res://*/Model.Lipigas.ssdl|res://*/Model.Lipigas.msl;provider=Oracle.DataAccess.Client;provider connection string=&quot;DATA SOURCE=SLLCOSTO;PASSWORD=uni_1915sll;USER ID=PEDIDO&quot;" providerName="System.Data.EntityClient" /> 
    </connectionStrings> 
</configuration> 

EDIT:

Ceci est le WSDL:

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://ws.lipigas.cl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="SvcLipigas" targetNamespace="http://ws.lipigas.cl"> 
<wsdl:types> 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://ws.lipigas.cl"> 
<xs:element name="AlmacenaPedido"> 
<xs:complexType> 
<xs:sequence> 
<xs:element minOccurs="0" name="telefono" nillable="true" type="xs:string"/> 
<xs:element minOccurs="0" name="fechaPedido" nillable="true" type="xs:string"/> 
<xs:element minOccurs="0" name="horaPedido" nillable="true" type="xs:string"/> 
<xs:element minOccurs="0" name="codigoInterno" nillable="true" type="xs:string"/> 
<xs:element minOccurs="0" name="descripcionProducto" nillable="true" type="xs:string"/> 
<xs:element minOccurs="0" name="cantidadProducto" nillable="true" type="xs:string"/> 
<xs:element minOccurs="0" name="valorUnitario" nillable="true" type="xs:string"/> 
<xs:element minOccurs="0" name="kilosProducto" nillable="true" type="xs:string"/> 
<xs:element minOccurs="0" name="fechaEntrega" nillable="true" type="xs:string"/> 
<xs:element minOccurs="0" name="horaEntrega" nillable="true" type="xs:string"/> 
<xs:element minOccurs="0" name="fechaDespacho" nillable="true" type="xs:string"/> 
<xs:element minOccurs="0" name="horaDespacho" nillable="true" type="xs:string"/> 
</xs:sequence> 
</xs:complexType> 
</xs:element> 
<xs:element name="AlmacenaPedidoResponse"> 
<xs:complexType> 
<xs:sequence> 
<xs:element minOccurs="0" name="AlmacenaPedidoResult" type="xs:int"/> 
</xs:sequence> 
</xs:complexType> 
</xs:element> 
</xs:schema> 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://schemas.microsoft.com/2003/10/Serialization/" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://schemas.microsoft.com/2003/10/Serialization/"> 
<xs:element name="anyType" nillable="true" type="xs:anyType"/> 
<xs:element name="anyURI" nillable="true" type="xs:anyURI"/> 
<xs:element name="base64Binary" nillable="true" type="xs:base64Binary"/> 
<xs:element name="boolean" nillable="true" type="xs:boolean"/> 
<xs:element name="byte" nillable="true" type="xs:byte"/> 
<xs:element name="dateTime" nillable="true" type="xs:dateTime"/> 
<xs:element name="decimal" nillable="true" type="xs:decimal"/> 
<xs:element name="double" nillable="true" type="xs:double"/> 
<xs:element name="float" nillable="true" type="xs:float"/> 
<xs:element name="int" nillable="true" type="xs:int"/> 
<xs:element name="long" nillable="true" type="xs:long"/> 
<xs:element name="QName" nillable="true" type="xs:QName"/> 
<xs:element name="short" nillable="true" type="xs:short"/> 
<xs:element name="string" nillable="true" type="xs:string"/> 
<xs:element name="unsignedByte" nillable="true" type="xs:unsignedByte"/> 
<xs:element name="unsignedInt" nillable="true" type="xs:unsignedInt"/> 
<xs:element name="unsignedLong" nillable="true" type="xs:unsignedLong"/> 
<xs:element name="unsignedShort" nillable="true" type="xs:unsignedShort"/> 
<xs:element name="char" nillable="true" type="tns:char"/> 
<xs:simpleType name="char"> 
<xs:restriction base="xs:int"/> 
</xs:simpleType> 
<xs:element name="duration" nillable="true" type="tns:duration"/> 
<xs:simpleType name="duration"> 
<xs:restriction base="xs:duration"> 
<xs:pattern value="\-?P(\d*D)?(T(\d*H)?(\d*M)?(\d*(\.\d*)?S)?)?"/> 
<xs:minInclusive value="-P10675199DT2H48M5.4775808S"/> 
<xs:maxInclusive value="P10675199DT2H48M5.4775807S"/> 
</xs:restriction> 
</xs:simpleType> 
<xs:element name="guid" nillable="true" type="tns:guid"/> 
<xs:simpleType name="guid"> 
<xs:restriction base="xs:string"> 
<xs:pattern value="[\da-fA-F]{8}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{4}-[\da-fA-F]{12}"/> 
</xs:restriction> 
</xs:simpleType> 
<xs:attribute name="FactoryType" type="xs:QName"/> 
<xs:attribute name="Id" type="xs:ID"/> 
<xs:attribute name="Ref" type="xs:IDREF"/> 
</xs:schema> 
</wsdl:types> 
<wsdl:message name="ISvcLipigas_AlmacenaPedido_InputMessage"> 
<wsdl:part name="parameters" element="tns:AlmacenaPedido"/> 
</wsdl:message> 
<wsdl:message name="ISvcLipigas_AlmacenaPedido_OutputMessage"> 
<wsdl:part name="parameters" element="tns:AlmacenaPedidoResponse"/> 
</wsdl:message> 
<wsdl:portType name="ISvcLipigas"> 
<wsdl:operation name="AlmacenaPedido"> 
<wsdl:input wsaw:Action="http://ws.lipigas.cl/ISvcLipigas/AlmacenaPedido" message="tns:ISvcLipigas_AlmacenaPedido_InputMessage"/> 
<wsdl:output wsaw:Action="http://ws.lipigas.cl/ISvcLipigas/AlmacenaPedidoResponse" message="tns:ISvcLipigas_AlmacenaPedido_OutputMessage"/> 
</wsdl:operation> 
</wsdl:portType> 
<wsdl:service name="SvcLipigas"/> 
</wsdl:definitions> 
+0

Pouvez-vous voir le contrat d'exploitation sur votre WSDL ?. – Kalyan

+0

Veuillez partager le code client qui fait une demande de service – Kalyan

+0

@KalyanaSundaram J'ai ajouté le WSDL entier à la question. là, vous pouvez voir le contrat d'exploitation. – jstuardo

Répondre

0

Vous avez activé httpsGet. Mais vous n'avez pas spécifié d'URL. Effectuez les opérations suivantes pour corriger le problème

<behaviors> 
<serviceBehaviors> 
    <behavior name="serviceBehavior"> 
    <serviceMetadata httpsGetEnabled="true" 
    httpsGetUrl="https://myComputerName/myEndpoint" /> 

Si vous ne l'utilisez SSL puis retirez httpsGetenabled

suivre le lien ci-dessous pour une meilleure compréhension http://www.allenconway.net/2012/05/creating-wcf-restful-service-and-secure.html

+0

Cela n'a pas aidé, et en fait, dans web.config, avant le paramètre serviceMetadata, ce commentaire apparaît: . cela me suggère que ce paramètre n'a rien à voir avec l'erreur de définition du point de terminaison. – jstuardo