更改返回错误值的区域设置 - Web服务

时间:2011-12-08 10:10:59

标签: c# .net currentculture regional-settings

我的系统处于“美国”文化中。现在我把我的文化改成了“土耳其”。

请查看以下代码

这是服务文件service1.svc.cs

[ServiceBehavior]
public class SPPChatService : IService
{

public string getValue()
{
return "Gcid";
}
}

这是我的asp.net代码

 private IService CreateNewChannel()
    {
        #region Define WCF Binding
        //Binding
        WSHttpBinding bindingSupportChatService = new WSHttpBinding(SecurityMode.None, false);
        //Reader Quotas
        XmlDictionaryReaderQuotas readerQuotas = new XmlDictionaryReaderQuotas();
                    bindingSupportChatService.ReaderQuotas = readerQuotas;
        #endregion
        #region Define Endpoint object
        string chatServiceURL = WebConfigurationManager.AppSettings["ChatServiceURL"];
        EndpointAddress endpointSupportChatService = new EndpointAddress(chatServiceURL);
        #endregion
        //create a channel to the service
        ChannelFactory<IService> channelFactorySupportChatService = new ChannelFactory<IService>(bindingSupportChatService, endpointSupportChatService);
        channelChatService = channelFactorySupportChatService.CreateChannel();
        return channelChatService;
    }

page_load method()
{
 channelService = CreateNewChannel();
 //calling webservice method here
 (channelService as IService).getValue();
}

// 由于我的系统在土耳其文化,我得到了别的东西。即使它在任何区域设置,我怎么能得到完全“Gcid”。 .net 3.5和VS 2010是我的环境

0 个答案:

没有答案