We have WCF based SOA architecture and ASP.NET web application consume the services hosted. Within each method that needs service call, we create a proxy instance and close when the results are returned. The binding is basicHttpBinding. By default InstanceContextMode is per session, do we need to change this to Percall as we do not require any state full calls in the application. Does this improve any performance?
Related
I have a WCF service that is hosted in a windows service. It shares the same libraries as an ASP.NET project. The WCF service is used to process long running operations that I don't want the ASP.NET site running. I'm using Autofac to handle dependencies in both the ASP.NET and WCF project. Since I'm using ASP.NET, I'm using the InstancePerLifeTimeScope() method on all registrations. Since these same registration modules are also used in the WCF service, I was hoping they would create instances per WCF method call, but that is not happening. Is there a way to get Autofac to consider an object's lifetime scope the same as the life time as a service call?
I hope that makes sense.
Assuming you are using the Autofac service hosting mechanism, if you register your service-related objects as InstancePerDependency and set your InstanceContextMode to PerCall, each call should get its own dependencies resolved. Autofac doesn't have an explicit "per call" lifetime setting for WCF.
We are developing an ASP.NET web application, this application will generate pages base on meta data (automatic page and controls generation), after this generation a javascript framework will load data for every control found on the generated page by invoking the WCF Rest service
my first question is : is it possible to share session data between the ASP.NET web application and WCF Rest service and how to do that? for the first uses we will deploy the ASP.NET web application and its service on the same machin to reduce complexity
my second question is : wich cache-framework you recommend to cache data on the WCF Rest services? we will not cache the output responses of the wcf service instead we will cache the modified user data on the service to simulate a user session
I would appreciate any help on how to deal with this problem
Thanks in advance
Regards
A good article on asp.net sessions from wcf
I don't have any problems with System.Web.HttpRuntime.Cache in WCF (I am only hosting the WCF in IIS - for sure). MemCache is very popular otherwise.
I have a WCF service hosted at IIS7 web application. It's created by a WebServiceHostFactory. The client connects to a service calls the Collect method, and data are stored to DB. All working fine.
Now I would like to refresh page every time the new data are "collected" (i.e. the service method Collect is called).
My question is: What is the best approach ?
I was considering the CallbackContract, but this would require a singleton pattern (service is now PerCall), or is it a wrong assumption ? Is this approach possible ?
My logic is:
ASP.NET page subscribes to WCF service
the service singleton is created from now on
when method is called the services calls subscribers (clients)
there should be therefore only one service instance in order to subscription to work (or is it ?)
the client page refreshes itself
regards,
Kate
You can't refresh the page in a user's browser from the sever. Browsers use HTTP, which is a request-response protocol, so if the browser hasn't issued a request, it won't be looking for a response from your server.
If you have a Silverlight application hosted in a browser, that's a different story, but you didn't mention Silverlight anywhere. You would also be able to do what you're asking using WebSockets in HTML5, but that's not fully standardized yet.
MY applictaion = Asp.net 4.0 + EF + WCF services + Database MYSQL all are different project(n tier architecture)
I am using sessionState mode="Custom"(storing session info in the DB) in my WEB project
My problem==> I know the session ID but how to get other session value in the other project like WCF Project
The ASP.NET Session cannot be shared between different applications that are hosted in different application pools in IIS. There are hacks that could allow you to do it but it is not recommended. The WCF service shouldn't depend on any session or it will be less reusable. The ASP.NET application which is consuming this service could pass all the necessary information when invoking a method.
I have an ASP.NET application that calls other web services through SSL (outside the application). I simply added a web reference (https://url/some.asmx) and used the web services and it works well. However, my questions are, how is the connection (channel) managed? is the connection to web services dropped after each web services call? or do they use the same connection (channel) for the subsequent calls? if they do, how long is the trusted connection kept alive?
Classic ASMX web services maintain the connection for a single request - that's why the methods you call via the web service class must be static. A SOAP call is very similar to a plain vanilla HTTP Request:
Open connection to URL
Pass in request - get/post, etc
Server renders an XML (SOAP) response
Connection is closed
Client processes response.
The web service framework wraps most of this so that you can conveniently access the web service as if it were a local object, but there is no server-side object instance persistence any more than there is for an ASPX page.
WCF services, on the other hand, maintain the connection until the proxy object is closed. This gives you a LOT of power, but, of course, with great power comes great responsibility.
update: link regarding ssl caching:
http://social.msdn.microsoft.com/forums/en-US/asmxandxml/thread/f86066e0-a24b-4d5e-873c-ed427d1faef7/