Estoy intentando agregar una referencia de servicio WCF a mi aplicación web utilizando VS2010. Parece que añadir bien, pero el web.config no se actualiza, lo que significa recibo una excepción en tiempo de ejecución:Al agregar referencia de servicio WCF, los detalles de configuración no se agregan a web.config
no se pudo encontrar el punto final predeterminado elemento que las referencias contrato 'CoolService.CoolService' en la configuración del cliente ServiceModel sección. Esto podría deberse a que no se encontró el archivo de configuración para su aplicación , o porque no se encontró ningún elemento del punto final que coincida con este contrato en el elemento del cliente.
Obviamente, porque el servicio no está definido en mi web.config. Pasos para reproducir:
- Haga clic derecho en la solución> Agregar> Nuevo proyecto> ASP.NET Empty Web Application.
- Haga clic con el botón derecho en Referencias de servicio en la nueva aplicación web> Agregar referencia de servicio.
- Ingrese la dirección de mi servicio y haga clic en Ir. Mi servicio está visible en la sección Servicios a la izquierda y puedo ver todas sus operaciones.
- Escriba un espacio de nombres para mi servicio.
- Haga clic en Aceptar. La referencia de servicio se genera correctamente y puedo abrir el archivo Reference.cs y todo se ve bien.
Abra el archivo web.config. Todavía está vacío!
<system.web> <compilation debug="true" targetFramework="4.0" /> </system.web> <system.serviceModel> <bindings /> <client /> </system.serviceModel>
Por qué sucede esto? También ocurre con una aplicación de consola o cualquier otro tipo de proyecto que intento. ¿Alguna ayuda?
Aquí es el app.config de mi servicio WCF:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="CoolSQL.Server.WCF.CoolService">
<endpoint address=""
binding="webHttpBinding"
contract="CoolSQL.Server.WCF.CoolService"
behaviorConfiguration="SilverlightFaultBehavior">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/Design_Time_Addresses/CoolSQL.Server.WCF/CoolService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="webBehavior">
<webHttp />
</behavior>
<behavior name="SilverlightFaultBehavior">
<silverlightFaults />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="DefaultBinding"
bypassProxyOnLocal="true"
useDefaultWebProxy="false"
hostNameComparisonMode="WeakWildcard"
sendTimeout="00:05:00"
openTimeout="00:05:00"
receiveTimeout="00:00:10"
maxReceivedMessageSize="2147483647"
transferMode="Streamed">
<readerQuotas maxArrayLength="2147483647"
maxStringContentLength="2147483647" />
</binding>
</webHttpBinding>
</bindings>
<extensions>
<behaviorExtensions>
<add name="silverlightFaults"
type="CoolSQL.Server.WCF.SilverlightFaultBehavior, CoolSQL.Server.WCF" />
</behaviorExtensions>
</extensions>
<diagnostics>
<messageLogging logEntireMessage="true"
logMalformedMessages="false"
logMessagesAtServiceLevel="true"
logMessagesAtTransportLevel="false"
maxMessagesToLog="3000"
maxSizeOfMessageToLog="2000" />
</diagnostics>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0"
sku=".NETFramework,Version=v4.0" />
</startup>
<system.diagnostics>
<sources>
<source name="System.ServiceModel.MessageLogging"
switchValue="Information, ActivityTracing">
<listeners>
<add name="messages"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData="c:\messages.e2e" />
</listeners>
</source>
</sources>
</system.diagnostics>
</configuration>
¿Está su configuración del lado del servidor en la aplicación * y * de la consola del proyecto del servicio WCF? –
No, solo en el proyecto de servicio WCF. –