Web.Config AppSettings&高速缓存 [英] Web.Config AppSettings & Caching

查看:77
本文介绍了Web.Config AppSettings&高速缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨:


我写了几个从web.config文件获取连接的web应用程序

字符串。这非常容易使用,它可以很容易地将应用程序从开发转移到生产中。


我正在编写一个会有很多流量的网站

我正试图在每个地方节省资源。


我的问题是 - 做web.config应用程序设置在

应用程序启动时加载一次 - 或者应用程序每次请求连接字符串时都会读取整个XML

web.config文件。


如果每次都读取web.config,我会创建一个简单的类

库来返回字符串。


感谢您的帮助!


Fred

Hi:

I have written several web applications that obtain their connection
strings from the web.config file. This is very easy to use and it makes
it easy to move an app from development into production.

I''m in the process of writing a site that will have lots of traffic so
I''m trying to save resources everyplace that I can.

My question is - do the web.config app settings get loaded once when the
application starts - or does the application read the entire XML
web.config file everytime that I request the connection string.

If the web.config is read each time then I will create a simple class
library to return the string.

Thanks for your help!

Fred

推荐答案

如果覆盖web.config,应用程序将重新启动。这是一个

指示符,表示在应用程序启动时读取整个文件或者

不需要重新启动它。


更好的方法是在SQL服务器中存储应用程序的配置设置

,这样如果您的应用程序动态变化,您不需要

来中断对其用户的服务。


-

Terry Burns
http://TrainingOn.net

Fred Nelson < FR ** @ smartybird.com>在消息中写道

新闻:Oy ************** @ TK2MSFTNGP14.phx.gbl ...
If you overwrite the web.config, the application restarts. This is an
indicator that the entire file is read when the application starts or it
would not need to restart it.

The better approach is to store configuration settings for the application
in an SQL sever, this way if your application dynamics change you dont need
to interupt service to its users.

--
Terry Burns
http://TrainingOn.net
"Fred Nelson" <fr**@smartybird.com> wrote in message
news:Oy**************@TK2MSFTNGP14.phx.gbl...
嗨:

我写了几个Web应用程序,它们从web.config文件中获取它们的连接字符串。这非常容易使用,它可以轻松地将应用程序从开发转移到生产中。

我正在编写一个拥有大量流量的网站
我正在尝试尽可能地节省资源。

我的问题是 - 当
应用程序启动时,web.config应用程序设置会被加载一次 - 或者是每次请求连接字符串时,应用程序都会读取整个XML
web.config文件。

如果每次都读取web.config,那么我将创建一个简单的类
库返回字符串。

感谢您的帮助!

Fred
Hi:

I have written several web applications that obtain their connection
strings from the web.config file. This is very easy to use and it makes
it easy to move an app from development into production.

I''m in the process of writing a site that will have lots of traffic so
I''m trying to save resources everyplace that I can.

My question is - do the web.config app settings get loaded once when the
application starts - or does the application read the entire XML
web.config file everytime that I request the connection string.

If the web.config is read each time then I will create a simple class
library to return the string.

Thanks for your help!

Fred



它''在第一次请求后缓存。


Karl


-
http://www.openmymind.net/


" Fred Nelson" < FR ** @ smartybird.com>在消息中写道

新闻:Oy ************** @ TK2MSFTNGP14.phx.gbl ...
It''s cached after the first request to it.

Karl

--
http://www.openmymind.net/

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:Oy**************@TK2MSFTNGP14.phx.gbl...
嗨:

我写了几个Web应用程序,它们从web.config文件中获取它们的连接字符串。这非常容易使用,它可以轻松地将应用程序从开发转移到生产中。

我正在编写一个拥有大量流量的网站
我正在尝试尽可能地节省资源。

我的问题是 - 当
应用程序启动时,web.config应用程序设置会被加载一次 - 或者是每次请求连接字符串时,应用程序都会读取整个XML
web.config文件。

如果每次都读取web.config,那么我将创建一个简单的类
库返回字符串。

感谢您的帮助!

Fred
Hi:

I have written several web applications that obtain their connection
strings from the web.config file. This is very easy to use and it makes
it easy to move an app from development into production.

I''m in the process of writing a site that will have lots of traffic so
I''m trying to save resources everyplace that I can.

My question is - do the web.config app settings get loaded once when the
application starts - or does the application read the entire XML
web.config file everytime that I request the connection string.

If the web.config is read each time then I will create a simple class
library to return the string.

Thanks for your help!

Fred



>更好的方法是在SQL服务器中存储应用程序
> The better approach is to store configuration settings for the application
的配置设置,这样如果您的应用程序动态发生变化,您就不需要将服务中断到其用户。


除非有人正在开发数据库应用程序,否则这不是一个好主意。

SQL Server的许可非常昂贵。


其他一些注意事项:必须从数据库中反复获取频繁更改的经常使用的数据是一个性能问题。你b $ b可以缓存数据,但是你又遇到了动态更改

配置数据和应用程序无法识别的问题。我相信

这就是web.config文件被读取一次然后缓存的原因。

重新启动应用程序应该不是问题。首先,如果你是运行IIS 6的
,这可以优雅地完成,不会中断服务。

如果你使用IIS 5,它可能会导致服务中断但是,在不正确的时间做很少的事情,应该尽量减少所涉及的问题。

在任何一种情况下,应用程序应始终设计为处理

尽可能优雅地重新启动,因为这是某种可能性。


-

HTH,


Kevin Spencer

Microsoft MVP

..Net开发人员


假设上帝是只有一个想法 -

想法存在。

因此,上帝存在。


Terry Burns < me@mine.com>在消息中写道

news:O7 ************* @ TK2MSFTNGP15.phx.gbl ...如果覆盖web.config,应用程序将重新启动。这是一个
指示器,当应用程序启动时读取整个文件或者它不需要重新启动它。

更好的方法是存储应用程序的配置设置
在SQL服务器中,这种方式如果您的应用程序动态发生变化,您就不需要为其用户提供中断服务。

-
Terry Burns
http://TrainingOn.net

" Fred Nelson" < FR ** @ smartybird.com>在消息中写道
新闻:Oy ************** @ TK2MSFTNGP14.phx.gbl ...
in an SQL sever, this way if your application dynamics change you dont
need to interupt service to its users.
Unless one is developing a database application, this isn''t a good idea.
Licensing for SQL Server is quite expensive.

Some other considerations: Having to fetch frequently-used data that doesn''t
change very often from a database repeatedly is a performance issue. You
could cache the data, but again you run into the problem of changing the
configuration data on the fly and the app not being aware of it. I believe
this is why the web.config file is read once and then cached.

Restarting the app should not be a problem necessarily. First if you are
running IIS 6, this can be done gracefully, with no interruption of service.
If you are using IIS 5, it could cause an interruption in service, but doing
so infrequently and at the right time should minimize the issues involved.
In either case, the application should always be designed to handle a
restart as gracefully as possible, as this is a certain eventuality.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer

Presuming that God is "only an idea" -
Ideas exist.
Therefore, God exists.

"Terry Burns" <me@mine.com> wrote in message
news:O7*************@TK2MSFTNGP15.phx.gbl... If you overwrite the web.config, the application restarts. This is an
indicator that the entire file is read when the application starts or it
would not need to restart it.

The better approach is to store configuration settings for the application
in an SQL sever, this way if your application dynamics change you dont
need to interupt service to its users.

--
Terry Burns
http://TrainingOn.net
"Fred Nelson" <fr**@smartybird.com> wrote in message
news:Oy**************@TK2MSFTNGP14.phx.gbl...
嗨:
我已经编写了几个Web应用程序,它们从web.config文件中获取它们的连接字符串。这非常容易使用,它可以轻松地将应用程序从开发转移到生产中。

我正在编写一个拥有大量流量的网站
我正在尝试尽可能地节省资源。

我的问题是 - 当
应用程序启动时,web.config应用程序设置会被加载一次 - 或者是每次请求连接字符串时,应用程序都会读取整个XML
web.config文件。

如果每次都读取web.config,那么我将创建一个简单的类
库返回字符串。

感谢您的帮助!

Fred
Hi:

I have written several web applications that obtain their connection
strings from the web.config file. This is very easy to use and it makes
it easy to move an app from development into production.

I''m in the process of writing a site that will have lots of traffic so
I''m trying to save resources everyplace that I can.

My question is - do the web.config app settings get loaded once when the
application starts - or does the application read the entire XML
web.config file everytime that I request the connection string.

If the web.config is read each time then I will create a simple class
library to return the string.

Thanks for your help!

Fred




这篇关于Web.Config AppSettings&amp;高速缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆