Salve ragazzi, oggi mi sono cimentato nella creazione di un webservice WCF. Dopo averci smanettato un pò sono riuscito a creare un webservice che risiede in localhost ed a creare un sito web che richiami tramite js o jquery i servizi. Nel file Service.svc ho impostato il

codice:
Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory"
Il webservice è aggiunto come riferimento al sito web client, ma putroppo se provo ad istanziarlo in codebehind mi da errore di endpoint. C'è qualche impostazione da fare?

Webconfig WCF

codice:
<?xml version="1.0" encoding="utf-8"?>
<configuration>

  <system.web>
    <compilation debug="false" strict="false" explicit="true" targetFramework="4.0" />
    <pages>
      <namespaces>
        <add namespace="System.Runtime.Serialization" />
        <add namespace="System.ServiceModel" />
        <add namespace="System.ServiceModel.Web" />
      </namespaces>
    </pages>
  </system.web>
  <system.serviceModel>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          
          <serviceMetadata httpGetEnabled="true"/>
          
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true"  aspNetCompatibilityEnabled="True"/>
    <standardEndpoints>
      <webScriptEndpoint>
        <standardEndpoint name="" crossDomainScriptAccessEnabled="true"/>
      </webScriptEndpoint>
    </standardEndpoints>
  </system.serviceModel>
  <system.webServer>
   <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>
  
</configuration>

WebConfig sito web client

codice:
<?xml version="1.0"?>
<!--
  Per ulteriori informazioni su come configurare l'applicazione ASP.NET, visitare il sito Web all'indirizzo
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
	<system.web>
		<compilation debug="true" strict="false" explicit="true" targetFramework="4.0"/>
	</system.web>
	<system.serviceModel>
		<bindings>
   <basicHttpBinding>
    <binding name="BasicHttpBinding_AjaxService" closeTimeout="00:01:00"
     openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
     allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
     maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
     messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
     useDefaultWebProxy="true">
     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
      maxBytesPerRead="4096" maxNameTableCharCount="16384" />
     <security mode="None">
      <transport clientCredentialType="None" proxyCredentialType="None"
       realm="" />
      <message clientCredentialType="UserName" algorithmSuite="Default" />
     </security>
    </binding>
   </basicHttpBinding>
  </bindings>
		<client>
   <endpoint address="http://localhost/tdestservice/ServiceCB.svc"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_AjaxService"
    contract="JsonpAjaxServiceCB.AjaxService" name="BasicHttpBinding_AjaxService" />
  </client>
    <services>
      <service name="TestService">
        <endpoint address="soap" binding="basicHttpBinding" contract="IService"/>
        <endpoint address="json" binding="webHttpBinding"  behaviorConfiguration="jsonBehavior" contract="IService"/>
      </service>
    </services>
  </system.serviceModel>
</configuration>
Service.svc è quello che uso in questo momento per interfacciarmi con js e jquery. Ho aggiunto in codebehind

codice:
ScriptManager1.Services.Add(New System.Web.UI.ServiceReference("http://localhost/tdestservice/Service.svc"))
Spero di aver scritto tutto quello che occore