publicar wsdl exemplo simples

14/08/2013

0

Boa tarde pessoal, vcs sabem onde encontro um exemplo simples, passo a passo de como criar um wcf e publicar seus wsdl?
Fiz um wcf aqui com esse web.config
<?xml version="1.0"?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    <add key="ConnectionStringDNE" value="RGF0YSBTb3VyY2U9T05DT1BST0RTUlYxNjI7SW5pdGlhbCBDYXRhbG9nPURORTtVc2VyIElEPW15Y2xpbmljO1Bhc3N3b3JkPW15Y2xpbmlj"/>
  </appSettings>
  <system.web>
    <compilation debug="true"/>
    <httpRuntime/>
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IOncoCepService" receiveTimeout="03:00:00"
          maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="100000" maxArrayLength="2147483647"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service behaviorConfiguration="MyServiceTypeBehaviors" name="WcfCepOnco.OncoCepService">
        <endpoint address="http://200.170.114.190/oncocepservice"
          binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IOncoCepService"
          name="BasicOncoCepService" bindingNamespace="http://200.170.114.190/oncocepservice"
          contract="WcfCepOnco.IOncoCepService" />
        
        <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
                  name="WcfCepOnco.IOncoCepService" contract="WcfCepOnco.IOncoCepService" />

        <host>
          <baseAddresses>
            <add baseAddress="http://200.170.114.190/oncocepservice/OncoCepService.svc"/>
          </baseAddresses>
        </host>

        </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyServiceTypeBehaviors">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="false" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>



mas quando acesso da máquina externa da rede ele não encontra meus métodos
ele está até publicado se quiserem tentar acessar..
obrigado
Eric Miranda

Eric Miranda

Responder

Posts

16/08/2013

Joel Rodrigues

Veja se estes links lhe ajudam:
[url]http://www.codeproject.com/Articles/150066/Create-Host-Self-Hosting-IIS-hosting-and-Consume-W[/url]
[url]http://msdn.microsoft.com/en-us/library/bb924407.aspx[/url]
Responder

19/08/2013

Eric Miranda

Valeu Joel pelas dicas.. Com os exemplos citados estou quase conseguindo chegar ao ponto final.
Meu único problema é que no soap:address location não estou conseguindo colocar o ip externo...
segue meu web.config
<?xml version="1.0"?>
<configuration>

  <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
  </appSettings>
  <system.web>
    <compilation debug="true"/>
	<customErrors mode="Off"/>
    <httpRuntime/>
  </system.web>
  <system.serviceModel>
      <bindings>
          <basicHttpBinding>
              <binding name="basic_binding" /> 
          </basicHttpBinding>
      </bindings>
      <services>
        <service behaviorConfiguration="BasicBehavior_IValidar" name="WcfExemplo.Validar">
              <endpoint name="BasicWcfExemplo" address="Validar.svc" 
                  binding="basicHttpBinding" bindingConfiguration="basic_binding"
                  bindingNamespace="http://200.170.114.190/wcfexemplo/"
                  contract="WcfExemplo.IValidar" />
              <endpoint name ="mex" address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
          <host>
            <baseAddresses>
              <add baseAddress="http://200.170.114.190/wcfexemplo" />
            </baseAddresses>
          </host>
          </service>
      </services>
    
    <behaviors>
      <serviceBehaviors>
        <behavior name="BasicBehavior_IValidar">
          <serviceMetadata httpGetEnabled="true" httpGetUrl="http://200.170.114.190/wcfexemplo/Validar.svc/BasicWcfExemplo"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>
  </system.webServer>

</configuration>



como pode ver ele aparece o nome da minha máquina..Já vi alguma coisa que tenho que editar o binding do iis, mas se ponho esse ip ele me dá erro..

alguma sugestão?
Responder

Assista grátis a nossa aula inaugural

Assitir aula

Saiba por que programar é uma questão de
sobrevivência e como aprender sem riscos

Assistir agora

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar