asp.net - Could not find default endpoint element error in web application referencing own service -


i have created wcf service using asp.net 4 , trying connect inside own web application project, gives me "could not find default endpoint element" error.

none of answers similar question seem me, since seem deal external project references service , missing configuration file.

the service works when methods used directly (ex: js calls).

any ideas? please view servicemodel section below:

<system.servicemodel>   <behaviors>     <servicebehaviors>       <behavior name="metadatabehavior">         <servicemetadata httpgetenabled = "true"/>       </behavior>     </servicebehaviors>     <endpointbehaviors>       <behavior name="webhttpbehavior">         <webhttp />       </behavior>     </endpointbehaviors>   </behaviors>   <bindings>     <webhttpbinding>       <binding name="webhttpbindingwithjsonp" crossdomainscriptaccessenabled="true" />     </webhttpbinding>   </bindings>   <services>     <service name="mapiwebservice.crmservice" behaviorconfiguration="metadatabehavior">       <host>         <baseaddresses>           <add baseaddress="http://localhost:64049/service/crmservice.svc"/>         </baseaddresses>       </host>       <endpoint address="" binding="webhttpbinding" bindingconfiguration="webhttpbindingwithjsonp" contract="mapiwebservice.crmservice" behaviorconfiguration="webhttpbehavior" />       <endpoint address="http://localhost:64049/service/crmservice.svc/mex" binding="mexhttpbinding" contract="imetadataexchange"/>     </service>   </services> </system.servicemodel> 

here're opening lines of service class:

namespace mapiwebservice {     [servicecontract]     [aspnetcompatibilityrequirements(requirementsmode = aspnetcompatibilityrequirementsmode.allowed)]     public class crmservice : portalservice     {         [operationcontract]         [webget(responseformat = webmessageformat.json)]         public string authenticate(string username, string password) 

change <endpoint address="http://localhost:64049/service/crmservice.svc/mex" binding="mexhttpbinding" contract="imetadataexchange"/> to

<endpoint address="mex" binding="mexhttpbinding" contract="imetadataexchange"/> 

and try http://localhost:64049/service/crmservice.svc/mex referencing service.

update:

your contract should [servicecontract] interface unless crmservice servicecontract

<endpoint address="" binding="webhttpbinding" bindingconfiguration="webhttpbindingwithjsonp" contract="mapiwebservice.icrmservice" behaviorconfiguration="webhttpbehavior" /> 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -