none
Erro ao publicar WCF no IIS 6 - Service 'Service' has zero application (non-infrastructure) endpoints. RRS feed

  • Pergunta

  • Boa tarde.

    Estou tentando criar um simples WCF e publicá-lo em um IIS 6.0.

    Localmente tudo funciona, mais em produção, no IIS, não.

    Ao digitar no browser o caminho https://meusite/MeuWCF/Service.svc?wsdl eu recebo um erro assim:

    Service 'Service' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.

    Meu web.config do WCF está assim:

    <?xml version="1.0"?>
    <configuration>
     <system.net>
      <mailSettings>
       <smtp>
        <network host="192.168.2.xx" port="2525" userName="" password=""/>
       </smtp>
      </mailSettings>
     </system.net>
     <appSettings>
      <add key="emailDe" value="no-reply@teste.com.br"/>
      <add key="emailPara" value="aaa@teste.com.br/>
     </appSettings>
     <system.web>
      <compilation debug="true" targetFramework="4.0"/>
     </system.web>
     <system.serviceModel>
      <behaviors>
       <serviceBehaviors>
        <behavior>
         <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
         <serviceMetadata httpGetEnabled="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>
      </behaviors>
      <serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
     </system.serviceModel>
     <system.webServer>
      <modules runAllManagedModulesForAllRequests="true"/>
     </system.webServer>
    </configuration>

     

    Não estou com problema para consumir o WCF, o problema é simplesmente conseguir enxergá-lo pelo Browser estando ele publicado. (o wsdl)

    Por favor me ajudem.

    Simplesmente abri o VS2010, criei o WCF, fiz um método básico e depois publiquei no IIS.

    terça-feira, 30 de novembro de 2010 15:39

Respostas

  • Israel,

    Eu verifiquei e tenho o 4.o instalado no servidor.

    Depois de muita busca e tentativa/erro meu web.config ficou da seguinte forma (meu serviço tem que ser HttpS):

     

    <?xml version="1.0"?>

    <configuration>
     <system.net>
      <mailSettings>
       <smtp>
        <network host="192.168.y.xx" port="2525" userName="" password=""/>
       </smtp>
      </mailSettings>
     </system.net>
     <appSettings>
      <add key="emailDe" value="no-reply@email.com.br"/>
      <add key="emailPara" value="teste@email.com.br"/>
     </appSettings>
     <system.web>
                    <customErrors mode="Off" />
      <compilation debug="true" targetFramework="4.0"/>
     </system.web>
     <system.serviceModel> 
            <services>
              <service name="Service">
               <host>
                  <baseAddresses>
                     <add baseAddress="https://meusite.com.br/EmailError_WCF/Service"/>
                  </baseAddresses>
               </host>
                 <endpoint address="" binding="basicHttpBinding" contract="IService" bindingConfiguration="basic" bindingName="basic"/>
          <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
              </service>
            </services>
      <behaviors>
       <serviceBehaviors>
        <behavior>
         <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
         <serviceMetadata 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>
      </behaviors>
      <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
          <bindings>
             <basicHttpBinding>
               <binding name="basic">
                 <security mode="Transport">
                     <transport clientCredentialType="None"/>
                  </security>
               </binding>
             </basicHttpBinding>
          </bindings>
     </system.serviceModel>
     <system.webServer>
      <modules runAllManagedModulesForAllRequests="true"/>
     </system.webServer>
    </configuration>

    Funcionou.

    Obrigado pela ajuda Israel.

    • Marcado como Resposta kauebranco quarta-feira, 1 de dezembro de 2010 11:50
    quarta-feira, 1 de dezembro de 2010 11:49

Todas as Respostas

  • Boas kaue,

    Provavelmente você não tem o WCF 4.0 instalado no servidor, que cria automaticamente os endpoints.

    Você tem duas opções: ou instala o .NET Framework 4.0 ou cria explicitamente os endpoints.
    http://www.israelaece.com
    quarta-feira, 1 de dezembro de 2010 10:03
    Moderador
  • Israel,

    Eu verifiquei e tenho o 4.o instalado no servidor.

    Depois de muita busca e tentativa/erro meu web.config ficou da seguinte forma (meu serviço tem que ser HttpS):

     

    <?xml version="1.0"?>

    <configuration>
     <system.net>
      <mailSettings>
       <smtp>
        <network host="192.168.y.xx" port="2525" userName="" password=""/>
       </smtp>
      </mailSettings>
     </system.net>
     <appSettings>
      <add key="emailDe" value="no-reply@email.com.br"/>
      <add key="emailPara" value="teste@email.com.br"/>
     </appSettings>
     <system.web>
                    <customErrors mode="Off" />
      <compilation debug="true" targetFramework="4.0"/>
     </system.web>
     <system.serviceModel> 
            <services>
              <service name="Service">
               <host>
                  <baseAddresses>
                     <add baseAddress="https://meusite.com.br/EmailError_WCF/Service"/>
                  </baseAddresses>
               </host>
                 <endpoint address="" binding="basicHttpBinding" contract="IService" bindingConfiguration="basic" bindingName="basic"/>
          <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
              </service>
            </services>
      <behaviors>
       <serviceBehaviors>
        <behavior>
         <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
         <serviceMetadata 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>
      </behaviors>
      <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
          <bindings>
             <basicHttpBinding>
               <binding name="basic">
                 <security mode="Transport">
                     <transport clientCredentialType="None"/>
                  </security>
               </binding>
             </basicHttpBinding>
          </bindings>
     </system.serviceModel>
     <system.webServer>
      <modules runAllManagedModulesForAllRequests="true"/>
     </system.webServer>
    </configuration>

    Funcionou.

    Obrigado pela ajuda Israel.

    • Marcado como Resposta kauebranco quarta-feira, 1 de dezembro de 2010 11:50
    quarta-feira, 1 de dezembro de 2010 11:49