Tips for ASP.NET Web Services
In this article, we explore some tips and tricks I have found useful for developing ASP.NET Web Services.
1- Disable HTTP/POST and HTTP/GET Protocols.
2- Use Chunky instead of chatty Design.
3- Store Application-Specific Settings in Web.Config
4- Try to Avoid ASP.NET Session state if you can.
Tip 1-Disable HTTP/POST and HTTP/GET Protocols
.NET will attempt to bind our Web Services to three different protocols : HTTP/POST, HTTP/GET and SOAP. We say attempt because it depending on the arguments and return types for a service. Bindings for these three protocols will be included in the WSDL file, and client will have option of choosing any one of them.
We can easily remove these bindings by adding the following code or section to our Web.Config.
[csharp]
<webservices>
<protocols>
<remove name="HttpPost" />
<remove name="HttpGet" />
</protocols>
</webservices>
[/csharp]
Above code will tell WSDL generator not to include include bindings for HTTP/POST and HTTP/GET.
Tip 2- Use Chunky Instead of Chatty Design
When we talk about performance and scalability in distributed system, we want to make sure that we minimize the numbers of call between the Client and Server. By doing this we can improve application speed and, reduce network traffic.
By Using Chatty Design we can reduce the number of netwonk calls to 33% of the Chatty design.
Tip 3- Store Application-Specific Settings in Web.Config
By using Web.config we can store application specific data(for example database connection strings, file paths, and so on) and ASP.NET Web services can take advantage of all of the features available to their .aspx pages.
Tip 4-Try to Avoid ASP.NET Session State if We Can
Session still suffers from several drawbacks. You should realize that it was not designed specifically for managing state in Web service applications,
Best approach to managing state is to use Ticketing System (as metadata in a SOAP header).
0 comments:
Post a Comment