Prevent IIS From Reusing Worker Processes For Separate AppDomains
Sep 21, 2010
When IIS restarts an ASP.Net (2.0) web application, it can either:
Recycle the AppDomain: Unload the AppDomain and load a new AppDomain on the same process (e.g. when HttpRuntime.UnloadAppDomain() is called, when web.config is changed).
Recycle the process: unload the AppDomain and load a new one on a new process (e.g. when invoking Recycle command on an AppPool via inetmgr, or when memory limit is reached).
Due to some internal reasons (trouble with legacy native code we depend upon), we cannot allow the first option. We just can't load the application twice on the same process.
Can IIS be somehow told to never allow worker process reuse?
I've tried preventing it myself by tracking whether an application has already started on a process once using a Mutex, and if so - throwing an exception during Application_Start()); I've also tried terminating the process by calling Environment.Exit() during Application_End(). The problem with both methods is that it causes any requests that arrive during Application_End or Application_Start to fail (unlike a manual process recycle, which fails absolutely no requests because they are redirected to the new process right away).
View 2 Replies
Similar Messages:
Sep 8, 2010
since asp.net contains multiple threads that are executing at the same time.so if 2 threads access an object (simple or complex) that i got from the the asp.net httpcontext Cache.can't this lead to state problems on that object if these 2 theads tried to modify/read it at the same time?so what kind of precautions should i implement?for example i am thinking maybe locking the object while working with it? (wont this cause performance problems?)or maybe when i retrieve some object from the cache i should create a copy from it?
or maybe i dont need to worry about this issue at all?
View 2 Replies
Mar 26, 2011
I have a floating div on my page that contains an image. While everything looks ok in VisualStudio 2008, when I post the page to my server, the text in the image below the upper div shifts to the left of the div.
You can see the problem in the top paragraph at this url [URL]
<%@ Page Language="VB" MasterPageFile="~/MasterPageMain.master" AutoEventWireup="false" CodeFile="About.aspx.vb" Inherits="About" title="About Us" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />....
View 2 Replies
Jul 3, 2010
I have implemented quickfix engine using asp.net and C#. and i am calling quickfix_net.dll which is written in unmanaged C++. but i am getting error like "Cannot pass a GCHandle across AppDomains" when calling quickfix_net.dll. but the same thing is running in console application but not under IIS i.e asp.net
SessionSettings settings = new SessionSettings(tradeClientPath);
ApplicationMessage application = new ApplicationMessage();
FileStoreFactory storeFactory = new FileStoreFactory(settings);
FileLogFactory logFactory = new FileLogFactory(settings);
MessageFactory messageFactory = new DefaultMessageFactory();
SocketInitiator initiator = new SocketInitiator
(application, storeFactory, settings, logFactory, messageFactory);
initiator.start();
Message message = new Message();
OrdType ordType = new OrdType(OrdType.MARKET);
QuickFix42.NewOrderSingle newOrderSingle = new QuickFix42.NewOrderSingle(new ClOrdID("1"), new HandlInst('1'), new Symbol("WAKEN0110048=2"), new Side(Side.BUY), new TransactTime(), new OrdType(OrdType.MARKET));
newOrderSingle.set(new OrderQty(10));
newOrderSingle.set(new TimeInForce(TimeInForce.DAY));
Message.Header header = newOrderSingle.getHeader();
header.setField(new SenderCompID("CLIENT1"));
header.setField(new TargetCompID("EXECUTOR"));
message = newOrderSingle;
**QuickFix.Session.sendToTarget(message);** // here i am getting exception
initiator.stop();
Web site reference is : [URL]
View 1 Replies
Jan 12, 2010
Application Pool may contain multiple worker processes (w3wp.exe) ?Application Pool may contain multiple Asp.NET Applications ?Asp.NET assigns one ThreadPool per AppDomain ?One AppDomain only contain one Web Application Instance but Application can contain multiple AppDomains ?
Edit : These questions are related to IIS 6x or higher, in which App Domains are available.
View 1 Replies
Mar 10, 2010
I'm running IIS 7 on Server 2008, with a single AppPool for an application which is basically just a collection of ASP.NET WebMethods. Some of these methods process for hours before they return. What's weird,is that sometimes when I launch multiple simultaneous requests IIS spins up a single w3wp process (and seems to share it amongst the requests) and other times it spins up multiple w3wp processes.
View 1 Replies
Dec 9, 2010
I want to get all the processes that is meant for a particular session.
i.e if there are two persons who are using my web application then i want to get all the processes used by user1 and all the processes used by user2.
I can get all processes by writing Process.GetProcesses() but how to get it in a group.
e.g:
User1: Process342
User1: Process151
User2: Process452
User2: Process674
User2: Process111
View 1 Replies
Jan 14, 2010
I have access to two seperate databases (mySQL) located on two servers. I need to get the data, link the tables on a key field and display the results in a datagrid. My challenge is that if the search criteria changes for the display it affects rows returned from on table and should thus automatically affect the linked table and resulting data returned.
what the best approach would be to achieving this? So far I have set up a dataset with a dataadapter and table for each connection and then linked the tables in the dataset. The problem that I'm having is getting the linked resultsets to work.
On my form I have the datagrid with two Objectdatasources one for each dataadapter and i believe that's where I'm going wrong...
View 1 Replies
Oct 15, 2010
in my ASP.NET app happen asynchronously (i.e in background threads without any access to HttpContext). Let me take an example of one such action. The app would be deployed to a web farm soon.
The background threads would be processing files deposited to a network share location. So, when the app starts, I create a FilesystemWatcher to monitor activities on the desired network share folder.
As soon as a new file arrives, the code processes it and marks it as completed processing.
The problem is with multiple servers watching the same network share, the same file might get processed on different machines, meaning redundant results. On a single server, I use locking mechanisms to prevent race conditions.
Now how to prevent the same on a web farm?
View 3 Replies
Mar 11, 2010
I'm currently using a certain ItemTemplate for three repeaters that are all on the same page, but they are all bound to different data sources. Is there any way to refactor my web form without using a user control to easily refer to this template so I will only have to define it once?
View 2 Replies
Jan 6, 2011
I have a custom collection PagedList<T> that is being returned from my WCF service as PagedListOfEntitySearchResultW_SH0Zpu5 when T is EntitySearchResult object. I want to reuse this PagedList<T> type between the application and the service. My scenario:
I've created a PagedList<T> type that inherits from List<T>. This type is on a separated assembly that is referenced on both application and WCF service. I'm using the /reference option on the scvutil to enable the type reusing. I also don't want any arrays returned so I also use the /collection to map to the generic List type. I'm using the following svcutil command to generate the service proxy:
"C:Program Files (x86)Microsoft SDKsWindowsv7.0ABinNETFX 4.0 Toolssvcutil.exe"
/collectionType:System.Collections.Generic.List`1
/reference:.... inDebugApp.Utilities.dll
http://localhost/App.MyService/MyService.svc?wsdl
/namespace:*,"App.ServiceReferences.MyService"
/out:..ServiceProxyMyService.cs
The PagedList object is something like:
[CollectionDataContract]
public partial class PagedList<T> : List<T>
{
public PagedList() { }
/// <summary>
/// Creates a new instance of the PagedList object and doesn't apply any pagination algorithm.
/// The only calculated property is the TotalPages, everything else needed must be passed to the object.
/// </summary>
/// <param name="source"></param>
/// <param name="pageNumber"></param>
/// <param name="pageSize"></param>
/// <param name="totalRecords"></param>
public PagedList(IEnumerable<T> source, int pageNumber, int pageSize, int totalRecords)
{
if (source == null)
source = new List<T>();
this.AddRange(source);
PagingInfo.PageNumber = pageNumber;
PageSize = pageSize;
TotalRecords = totalRecords;
}
public PagedList(IEnumerable<T> source, PagingInfo paging)
{
this.AddRange(source);
this._pagingInfo = paging;
}
[DataMember]
public int TotalRecords { get; set; }
[DataMember]
public int PageSize { get; set; }
public int TotalPages()
{
if (this.TotalRecords > 0 && PageSize > 0)
return (int)Math.Ceiling((double)TotalRecords / (double)PageSize);
else
return 0;
}
public bool? HasPreviousPage()
{
return (PagingInfo.PageNumber > 1);
}
public bool? HasNextPage() { return (PagingInfo.PageNumber < TotalPages()); }
public bool? IsFirstPage() { return PagingInfo.PageNumber == 1; }
public bool? IsLastPage() { return PagingInfo.PageNumber == TotalPages(); }
PagingInfo _pagingInfo = null;
[DataMember]
public PagingInfo PagingInfo
{
get {
if (_pagingInfo == null)
_pagingInfo = new PagingInfo();
return _pagingInfo;
}
set
{
_pagingInfo = value;
}
}
}
View 1 Replies
Sep 20, 2010
I'd like to display an animated gif after user presses a submit button which causes postback. I'm following Joe Stagner's tutorial
here. The page worked fine. But now that I've added the update panel around the button and then an update progress with a gif in it, the app doesn't run.
Now, when the button is pressed, the animated gif appears and runs for about three seconds or so (due to the artificial latency added as per the tutorial - System.Threading.Thread.Sleep(3000) ) and then it stops, nothing returns from the server.
What am I doing wrong and what am I not understanding with this Ajax process and the server?
(by the way I'm using the toolscript manager that came with the Ajax control toolkit, don't know if that matters)
[Code]....
View 4 Replies
Jan 15, 2010
I'm firing the my ModalPopupExtender from a server side button click (bthAuth) and then need to hide that button after my processing is complete. When btnAuth.Visible = False is called it displays the ModalPopupExtender. If I remove this piece of code the window goes away like it should.
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnAuth" BackgroundCssClass="modalBackground" PopupControlID="ModalPanel"> </cc1:ModalPopupExtender>
btnAuth_Click():
bunch of stuff here()
btnAuth.Visible = False -- This is what is causing the ModalPopupExtender to stay displayed.
On Page Load:
btnAuth.OnClientClick = String.Format("fnClickUpdate('{0}','{1}')", btnAuth.UniqueID, "")
Function:
<script type="text/javascript">
function fnClickUpdate(sender, e)
{
__doPostBack(sender,e);
}
</script>
View 4 Replies
Jun 24, 2010
I'm new to asp.net mvc. I'm looking to create some control for reusing HTML. I have a complex HTML box for example:
<div class="Box">
<div class="Top"></div>
<div class="Content">
<div style="padding:10px;">
[CONTENT GOES HERE]
</div>
</div>
<div class="Bottom"></div>
</div>
Previously using webforms I've been able to reuse this by inheriting from WebControl and override Render. But how can I implement this in MVC?
View 2 Replies
May 3, 2010
1) the user signs up for the first time. They see 3 different screens, their basic user information, their credit card, and some additional profile information. They complete these 3 steps in a wizard like fashion, where each time they hit "submit" they leave the current screen and move on to the next.2) the user already is signed up. He has links in the navigation to these 3 seperate pages. He can update them in any order. When he hits save, he doesn't leave the page he's on, it just shows something at the top that says "Credit Card Info saved..." or whatever. Possibly using ajax or maybe a full page refresh.I would like to reuse the code not only the view but also in the controller for these 3 screens between the two workflows, but without a ton of if...then logic to determine where to go next depending on whether its a first signup in the wizard or updating individual parts of a profile.
[code]...
View 2 Replies
Feb 4, 2010
I'm currently experiencing and issue on whether to say a connection has been left open due to my code or if it's left open due to ADO.NET pooling. Here's a sample of my code:
Public Function ExecuteDataTable(ByVal strStoredProc As String, Optional ByVal objParams As SqlParameter() = Nothing, Optional ByVal cmdType As CommandType = CommandType.StoredProcedure) As DataTable
Dim objDt As New DataTable
Dim objAdapt As New SqlDataAdapter
Dim objParam As SqlParameter
Try
OpenDb()
If Not IsNothing(objParams) Then
AddParams(objParams)
End If
objAdapt.SelectCommand = New SqlCommand
With objAdapt.SelectCommand
[Code].....
Then when I go to open up the SQL Mgmt Studio, I look into the processes and the particular connection that has ran with the SQL that my function runs appears to remain open. So to me, it looks like ADO.NET is performing some kind of pooling. Is it safe to make that conclusion? How would I be able to tell if the connection is available to be used again by the ADO.NET pool?
View 2 Replies
Sep 28, 2010
I have some code like this. But imagine that there are hundreds of lines like this all duplicated across multiple functions.
MyClass.prop1 = doingsomething("test1");
MyClass.prop2 = doingsomething("test55");
I want to reuse my code... how can I do it?
I want to do something like this:
foreach(ClassInfo)
{
dosomethingAssignment(ClassInfo.propertiesToAssign[i], ClassInfoStringIPassedToFunctionInFirstExample[i]);
}
Maybe this isn't the way to do this in C#, but what is the best way to reuse my code?
View 4 Replies
Apr 8, 2010
Our company has developed its own CMS system and there is a requirement that customers may purchase the source code for this system but only to be used for the one application (1 domain).My question is, is it possible to give them the source code but prevent them from reusing it to run another site (domain) for it.
My first thought was to have some license checking mechanism or have an uncompiled dll that checks the domain but obviously if they have the source code they can simply remove this code or checks.
View 1 Replies
Mar 19, 2011
How can I show loading image for the user while executing long running process in an ASP.Net Ajax application? Is there a way other than using Page Methods? Any ideas?
View 2 Replies
Feb 2, 2010
I'm working on a project that uses a master page. When the page loads I'm calling a class (which I feed and ID into) to get back certain values for a location that the user has selected. Things like town name etc.
On the home page I have a user control which has some statistics for that location too.
Is there a way that I can get the user control to pull values from the class invoked by the Master Page (which has already been fed the ID, hit the db and pulled back the values), rather than creating a new instance of the class within the user control and having to supply the ID and hit the db all over again? This is now I'm calling the class in the masterpage. I have a method "CheckForStoredLocation" that goes off and gets all the data I need.
[Code]....
View 4 Replies
Feb 2, 2010
I am beginner to ASP.NET MVC.
We are doing project in Asp.Net MVC and Nhibernate.
How to seperate my project in to layers ? how to design classes ?
should i followany patterns ? repository patterns ?
View 3 Replies
Sep 30, 2010
I want to be able to log when a user ends their session on our application and record whether it was a sign out or a the session expired. I am using
cookies.Add(new HttpCookie("ASP.NET_SessionId", ""));
to set a new sessionId on sign out, but when the session expires, the sessionId is reused if the browser instance is not closed. In my web.config I have used
<sessionState mode="InProc" timeout="1" cookieName="session" regenerateExpiredSessionId="true" />
but still get sessions reused. I can't kill the cookie in Session_end() because I don't have access because there is no HttpContext or request, so I can't reset it that way. how I can force a new sessionId from the Global.asax.cs file?
View 2 Replies
Jun 2, 2010
I'm using VS 2010. And in VS 2010 it's even more painful now to attach to the worker process when you want to test your local IIS site via IIS, not the VS built-in web server.It's more painful because now when you select the worker process () via the Debug Menu | Attach to Process | w3wp.exe it brings up an additional prompt asking if you're sure you want to do this.
View 1 Replies
Nov 17, 2010
I have increased the number of worker process of default application pool to 15(IIS->Application Pools->DefaultAppPool->Properties->Performance->webgarden).after increasing the worker process i am facing session timeouts
My application is using a state server session managemnet and a predefined machineKeyCan you please guide me in how to increase the worker process without session loss
View 1 Replies
Feb 24, 2010
I have a WCF service method that's running in a worker thread I spin from another method. I need to map a relative service app path ("~/Templates/a.template") to the physical path ("D:WebTemplatesa.template"), but I can't use HttpContext.Current.Server.MapPath because HttpContext.Current is null in a worker thread. How else can I reach MapPath method?
View 2 Replies