首页 > 解决方案 > DateTime Format Issue in c# for multiple Application on same IIS server

问题描述

I deployed my ASP.Net web application and WCF web service to the same default web site on the same IIS server with the same application pool. When I use the web application I see the DateTime.UtcNow value in dd/mm/yyyy format. When I use the WCF web service I see the DateTime.UtcNow value in mm/dd/yyyy format.

How can I make the two agree on the same format? Ideally it should get the local machine time format, which is mm/dd/yyyy. Is there any kind of settings is provided in the web.config file or machine config file or IIS settings so that all the application are able to fetch the correct date time format?

My WCF soap services uses the soapUi tool.

Below are the observed DateTime formats for each application:

main App: dd/mm/yyyy
wcf webservices: mm/dd/yyyy
local machine : mm/dd/yyyy
applicationPool:  asp.net4.5

标签: c#.netdatetimeiis

解决方案


推荐阅读