Professional ASP.NET 1.0 Special Edition- P36

Professional Special Edition- P36:Those of us who are Microsoft developers can't help but notice that .NET has received a fair amount of visibility over the last year or so. This is quite surprising considering that for most of this period, .NET has been in its early infancy and beta versions. I can't remember any unreleased product that has caused this much interest among developers. And that's really an important point, because ignoring all the hype and press, .NET really is a product for developers, providing a great foundation for building all types of applications | If Application ProductData City Is Nothing Then Application ProductData City LoadDataSet City End If Return CType Application ProductData City DataSet End Function Private Function LoadDataSet City As String As DataSet Dim dsn As String Dim sql As String dsn server localhost uid sa pwd database pubs sql SELECT FROM Authors WHERE City City Dim myConnection As New SqlConnection dsn Dim myCommand As New SqlDataAdapter sql myConnection Dim products As New DataSet products products Return products End Function End Class You might have to alter the server name in the code above to reflect your own database. Here a WebMethod named GetDataSet accepts a single parameter City. The result from the request will be output cached. The Web Service is executed once and served statically on subsequent requests for 30 seconds and the cache will vary based on the different value for City. If we have a request where the value of City is Dallas the Web Service will execute once and the result will be cached. If there is another request for Dallas within the allotted time period of 30 seconds it will be served from the cache - the Web Service does not need to execute and query the database. This can be a serious performance enhancement but should be used wisely - only items that vary by a few parameters are good candidates for Web Services output caching. Buffering the Server Response Buffering allows the server to buffer the output from the response and transmit it only once the response is completely buffered. For long running methods this might not be optimal - we d probably want to send the response as we receive it rather than waiting for the complete response. By default Web Services buffer the response before sending it as this is usually most optimal for the server. However the BufferResponse property allows us to configure Web Services to not buffer the response. By default this property is set to true. Using we would write

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
5    70    2    14-05-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.