Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

drigo

[Resolvido] Problemas com Silverlight e FaultExceptions.

Recommended Posts

Pessoal,

 

Estou tentando fazer com que o Silverlight 4 entenda o FaultExceptions, segui o respectivo link:

 

http://msdn.microsoft.com/en-us/library/dd470096%28VS.96%29.aspx .

 

Mas estou tendo problemas com a tag: <silverlightFaults/>, quando retiro a mesma consigo acessar o serviço perfeitamente, ao usar a mesma o seguinte erro é apresentado:

 

...

 

Parser Error Message: An error occurred creating the configuration section handler for system.serviceModel/behaviors: Extension element 'silverlightFaults' cannot be added to this element. Verify that the extension is registered in the extension collection at system.serviceModel/extensions/behaviorExtensions.

Parameter name: element

 

...

 

Segue abaixo o Web.config para uma melhor visualização:

 


<?xml version="1.0"?>

<configuration>
 <system.web>
   <compilation debug="true" targetFramework="4.0" />
   <customErrors mode="Off"/>
 </system.web>

 <system.serviceModel>

   <extensions>
     <behaviorExtensions>
       <add name="silverlightFaults"
            type="Servico.SilverlightFaultBehavior,
                  Servico,
                  Version=1.0.0.0,
                  Culture=neutral,
                  PublicKeyToken=null"/>
     </behaviorExtensions>
   </extensions>

   <services>
     <service name="Servico.Teste">
       <endpoint address=""
                 binding="basicHttpBinding"
                 contract="Servico.Teste"
                 bindingConfiguration="Servico.Teste.customBinding0"/>
       <endpoint address="mex"
                 binding="mexHttpBinding"
                 contract="IMetadataExchange" />
     </service>
   </services>

   <bindings>
     <basicHttpBinding>
       <binding name="Servico.Teste.customBinding0">
       </binding>
     </basicHttpBinding>
   </bindings>

   <behaviors>
     <serviceBehaviors>

       <behavior name="">
         <serviceMetadata httpGetEnabled="true" />
         <serviceDebug includeExceptionDetailInFaults="true" />
       </behavior>

     </serviceBehaviors>

     <endpointBehaviors>
       <behavior name="">
         <silverlightFaults/> // TAG QUE GERA O PROBLEMA APRESENTADO ACIMA.
       </behavior>
     </endpointBehaviors>

   </behaviors>

   <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
                              multipleSiteBindingsEnabled="true" />


 </system.serviceModel>

</configuration>

 

 

Como resolver tal situação, De forma ao Silverlight conseguir ententer o FaultException ?

 

 

Desde Já, Agradeço.

Compartilhar este post


Link para o post
Compartilhar em outros sites

O problema foi resolvido, segue abaixo o Web.config corrigido, isso pode ajudar alguem que esteja com o mesmo problema:

 

<?xml version="1.0"?>

<configuration>
 <system.web>
   <compilation debug="true" targetFramework="4.0" />
   <customErrors mode="Off"/>
 </system.web>

 <system.serviceModel>

   <extensions>
     <behaviorExtensions>
       <add name="silverlightFaults"
            type="Servico.SilverlightFaultBehavior, Servico, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
     </behaviorExtensions>
   </extensions>

   <services>
     <service name="Servico.Teste">
       <endpoint address="" 
                 binding="customBinding" 
                 contract="Servico.Teste" 
                 behaviorConfiguration="SilverlightFaultBehavior"
                 bindingConfiguration="Servico.Teste.customBinding0" />
       <endpoint address="mex" 
                 binding="mexHttpBinding" 
                 contract="IMetadataExchange" />
     </service>
   </services>

   <bindings>
     <customBinding>
       <binding name="Servico.Teste.customBinding0">
         <textMessageEncoding />
         <httpTransport />
       </binding>
     </customBinding>
   </bindings>

   <behaviors>
     <serviceBehaviors>
       <behavior name="">
         <serviceMetadata httpGetEnabled="true" />       
         <serviceDebug includeExceptionDetailInFaults="true" />
       </behavior>
     </serviceBehaviors>

     <endpointBehaviors>
       <behavior name="SilverlightFaultBehavior">
         <silverlightFaults/>
       </behavior>
     </endpointBehaviors>

   </behaviors>

   <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
       multipleSiteBindingsEnabled="true" />

 </system.serviceModel>
</configuration>

 

 

Atenciosamente.

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.