Asked by:
Methods of Wcf Rest are not found

Question
-
User-1350042179 posted
Hi
I have an app which is publish in https: https://www.vnbackoffice.cert.com.pe/InterfacesWeb/InterfacesWeb.svc
But when I want access to the rest method I can not. The result is: HTTP ERROR 400. For example: https://www.vnbackoffice.cert.com.pe/InterfacesWeb/InterfacesWeb.svc/Rest/CRM_ConsultarCargosComercios/20161230/20171219/-1
It works fine with http: https://www.vnbackoffice.cert.com.pe/InterfacesWeb/InterfacesWeb.svc/Rest/CRM_ConsultarCargosComercios/20161230/20171219/-1
I am going to include the webconfig of the service:
<?xml version="1.0"?> <configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> <section name="secureSettings" type="System.Configuration.NameValueSectionHandler" /> </configSections> <log4net> <appender name="LogFileAppender" type="log4net.Appender.FileAppender"> <param name="File" type="log4net.Util.PatternString" value="D:\Logs\Aplicaciones\VNInterfacesWeb\\Log_%property{LogName}.txt"/> <appendToFile value="true" /> <encoding value="utf-8" /> <layout type="log4net.Layout.PatternLayout"> <param name="ConversionPattern" value="%d [%t] %-5p %c %m%n"/> </layout> </appender> <root> <level value="ALL" /> <appender-ref ref="LogFileAppender" /> </root> </log4net> <system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <system.serviceModel> <services> <service name="Ws.InterfacesWeb.InterfacesWeb"> <endpoint address="" binding="wsHttpBinding" bindingConfiguration="InterfacesWeb.Binding" name="InterfacesWeb" contract="Ws.InterfacesWeb.IInterfacesWeb"> </endpoint> <endpoint name ="RESTEndPoint" contract ="Ws.InterfacesWeb.IInterfacesWebRest" binding ="webHttpBinding" address ="rest" bindingConfiguration="InterfacesWebRest.Binding" behaviorConfiguration ="restbehavior"/> </service> </services> <bindings> <webHttpBinding> <binding name="InterfacesWebRest.Binding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="4194304"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <security mode="None"> <transport clientCredentialType="None" /> </security> </binding> </webHttpBinding> <wsHttpBinding> <binding name="InterfacesWeb.Binding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <security mode="None"> <transport clientCredentialType="None" /> </security> </binding> <binding name="main" closeTimeout="00:20:00" openTimeout="00:20:00" receiveTimeout="00:20:00" sendTimeout="00:20:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <reliableSession ordered="true" inactivityTimeout="00:20:00" enabled="false" /> <security mode="None"> <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" /> <message clientCredentialType="Windows" negotiateServiceCredential="true" /> </security> </binding> <binding name="main1"> <security mode="None" /> </binding> <binding name="main2"> <security mode="None" /> </binding> <binding name="main3"> <security mode="None" /> </binding> <binding name="main4"> <security mode="None" /> </binding> <binding name="main5"> <security mode="None" /> </binding> </wsHttpBinding> </bindings> <client> <endpoint behaviorConfiguration="ManagementServiceBehaviour" binding="wsHttpBinding" bindingConfiguration="main" contract="ComerciosReference.IBackendService" name="ComerciosWSHttpBinding_IBackendService"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint behaviorConfiguration="ManagementServiceBehaviour" binding="wsHttpBinding" bindingConfiguration="main" contract="TerminalesReference.IBackendService" name="TerminalesWSHttpBinding_IBackendService"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint behaviorConfiguration="ManagementServiceBehaviour" binding="wsHttpBinding" bindingConfiguration="main" contract="OperacionesReference.IBackendService" name="OperacionesWSHttpBinding_IBackendService"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint behaviorConfiguration="ManagementServiceBehaviour" binding="wsHttpBinding" bindingConfiguration="main" contract="ConsultasReference.IBackendService" name="ConsultasWSHttpBinding_IBackendService"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint behaviorConfiguration="ManagementServiceBehaviour" binding="wsHttpBinding" bindingConfiguration="main" contract="InterfacesWebReference.IBackendService" name="InterfacesWebWSHttpBinding_IBackendService"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint behaviorConfiguration="ManagementServiceBehaviour" binding="wsHttpBinding" bindingConfiguration="main" contract="InterfaceReference.IBackendService" name="InterfaceWSHttpBinding_IBackendService"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="http://localhost:8732/Terminales" binding="wsHttpBinding" bindingConfiguration="main1" contract="TerminalesReference.IBackendService" name="main"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="http://localhost/Interfaces" binding="wsHttpBinding" bindingConfiguration="main2" contract="InterfaceReference.IBackendService" name="main1"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="http://localhost:8732/Operaciones" binding="wsHttpBinding" bindingConfiguration="main5" contract="OperacionesReference.IBackendService" name="main4"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="http://localhost:8732/InterfacesWeb" binding="wsHttpBinding" bindingConfiguration="main4" contract="InterfacesWebReference.IBackendService" name="main3"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="http://localhost:8732/Comercios" binding="wsHttpBinding" bindingConfiguration="main3" contract="ComerciosReference.IBackendService" name="main2"> <identity> <dns value="localhost" /> </identity> </endpoint> </client> <behaviors> <endpointBehaviors> <behavior name="ManagementServiceBehaviour"> <dataContractSerializer maxItemsInObjectGraph="2147483646"/> </behavior> <behavior name="restbehavior"> <webHttp/> </behavior> </endpointBehaviors> <serviceBehaviors> <behavior> <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false"/> <!-- 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="true"/> <dataContractSerializer maxItemsInObjectGraph="2147483646"/> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> <appSettings> <!--Funcion Seguridad--> <add key="user" value="USRSEG"/> <add key="pass" value="usrseg"/> <!--Ruta del Archivo Bindings--> <add key="rutaArchivoBindings" value="D:\Discovery\Bindings.txt"/> <!--Bindings Address--> <add key="InterfacesWeb" value="ServiceAgents.InterfacesWeb"/> <add key="Interface" value="ServiceAgents.Interfaces"/> <add key="Comercios" value="ServiceAgents.Comercios"/> <add key="Consultas" value="ServiceAgents.Consultas"/> <add key="Operaciones" value="ServiceAgents.Operaciones"/> <add key="Terminales" value="ServiceAgents.Terminales"/> <!--Carga Masiva - Información de los servidores--> <add key="NombreServidorWebOrigen" value="SERVIDORWEBORIGEN" /> <add key="NombreServidorLinuxBatch" value="SERVIDORLINUXBATCH" /> <!--Carga Archivo Cambios Masivos--> <add key="CodigoProcesoCargaCambioMasivo" value="CMCM" /> <!--Sftp--> <add key="SftpServidor" value="10.118.252.243" /> <add key="SftpPuerto" value="22" /> <add key="SftpUsuario" value="sgcidesa" /> <add key="SftpRutaArchivoDestino" value="/home/sgcidesa/file_in/" /> <add key="SftpRutaArchivoDescarga" value="/home/sgcidesa/file_out/" /> <add key="RutaArchivoOrigenCambiosMasivos" value="C:\FTPs\LocalUser\sgci\file_in\" /> <add key="RutaArchivoCargaCambiosMasivos" value="C:\FTPs\LocalUser\sgci\file_out\" /> </appSettings> <secureSettings> <add key="SftpPassword" value="desa" /> </secureSettings> </configuration>
Saturday, December 23, 2017 12:34 AM
All replies
-
User1168443798 posted
Hi neoaguil,<o:p></o:p>
What do you mean by this? The URL is same as not worked.<o:p></o:p>
Do you mean it works with http://....?<o:p></o:p>
For rest service works under both http and https, you will need to add two endpoints.<o:p></o:p>
A simple configuration like below:<o:p></o:p>
<system.serviceModel> <services> <service name="WCFRestSvc.Service1"> <endpoint address="" binding="webHttpBinding" behaviorConfiguration="web" contract="WCFRestSvc.IService1"/> <endpoint address="" binding="webHttpBinding" behaviorConfiguration="web" bindingConfiguration="https" contract="WCFRestSvc.IService1"/> </service> </services> <bindings> <webHttpBinding> <binding name="https"> <security mode="Transport"></security> </binding> </webHttpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior> <!-- 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>
Best Regards,<o:p></o:p>
Edward<o:p></o:p>
Monday, December 25, 2017 6:11 AM