How to define the culture in a WCF WebService?

6

I have a WCF plication running in IIS where the server language / culture is set entirely in English.

There is no way I can change the server settings so that I can change the server's culture or language. You would need an application-level solution.

I have tried to use Web.config the same setting that is used when you want to do this for ASP.NET applications but apparently WCF does not read this configuration:

//Diminuído para brevidade
<configuration> 
    <system.web>  
        <globalization culture="pt-BR" uiCulture="pt-BR" />
    <system.web> 
<configuration> 

Has anyone ever had this problem that can help me solve it?

    
asked by anonymous 31.01.2014 / 16:14

1 answer

3

If you use HTTP only, you can enable the aspNetCompatibilityEnabled property, so WCF will read the globalization settings.

<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>

This will cause your WCF to run in the same ASP.NET pipeline, which will make it impossible to use other protocols other than HTTP.

More information on MSDN

    
31.01.2014 / 16:53