I am trying to set the minWorkerThreads and minIoThreads
in order to tune it I understood it can be done via :
global aspx when server start :
int completionPortThreads = Int32.Parse(System.Configuration.ConfigurationManager.AppSettings["Service.CompletionPortThreads"] ?? "20");
int workerThreads = Int32.Parse(System.Configuration.ConfigurationManager.AppSettings["Service.WorkerThreads"] ?? "20");
bool setThreadPoolWorked = ThreadPool.SetMinThreads(workerThreads, completionPortThreads);
from XML :
2. machine config
processModel autoConfig="false" minWorkerThreads="100" minIoThreads="100"
it seems the iis is not taking the correct data or change the threads as he like. i tried to set in machine.config : autoconfig=false , but still it does not work properly.
any suggestions ?
Related
I'm trying to enable Lockout in our app.
In IdentityConfig.cs is the code to set some of the necessary flags.
manager.UserLockoutEnabledByDefault = true;
manager.DefaultAccountLockoutTimeSpan = TimeSpan.FromMinutes(5);
manager.MaxFailedAccessAttemptsBeforeLockout = 5;
I set 'ShouldLockout' to true in the AccountController's "Login" function.
But where does one set the last bit, i.e.
manager.SetLockoutEndDate(UserId, manager.DateTime.UtcNow.AddYears(50));
The setLockoutEndDate, needs the userId. Is that done at registration?
Thanks
I tried setting it at RegisterUser and that works.
I have a NodeJs application which is running in cluster mode with 4 instance.
A map is defined in a file "pipeline.js" like below :
var map = new Map();
module.exports = map;
I entered value in map like below :
map[value] = value_1;
In the code I have to remove the value from map but it gives error saying :
map[value] is empty.
But when rum with only 1 instance this error doesn't appear.
Thanks in advance !
I want run a foreach loop in a HtmlNode which has been parsed from internet via HtmlWebclass and loadFromWebAsync method. Before running the loop I want to make sure the that the node exists in the HtmlDocument. How do I check that without the help Xpath query because many of the Windows RT and Windows 8.1 version doesn't work with this.
You can use LINQ .Any() method to check if sequence contains any element, for example :
var doc = new HtmlDocument();
.....
var isDivExist = doc.DocumentNode
.Descendants("div")
.Any();
Or to check if any node in the sequence satisfies specific condition :
var isDivWithSpecificClassExist = doc.DocumentNode
.Descendants("div")
.Any(d => .GetAttributeValue("class", "") == "foo");
I've got the ServiceStack MiniProfiler enabled in my AppHost (in Application_Start), and I can view the SQL generated by OrmLite in my page. (using SS v3.9.59.0)
What I can't see in the profile trace is the values of bound parameters. So if OrmLite translates a LINQ expression into #0, I can't see the value sent to the DB as part of the query.
Here's an example trace from the profiler:
SELECT "SettingGroup" , "SettingKey" , "LastModified" , "SettingValue"
FROM "GlobalSetting"
WHERE (("SettingGroup" = #0) AND ("SettingKey" = 'a3849d59864b252a2022b4b8a164add1'))
I'd really like to know what value was sent for #0 for this query.
protected void Application_Start(object sender, EventArgs e)
{
Profiler.Settings.SqlFormatter = new InlineFormatter(true);
new AppHost().Init();
}
I've tried a few variants of the Profiler.Settings.SqlFormatter property:
SqlFormatter = new InlineFormatter();
SqlFormatter = new InlineFormatter(true);
SqlFormatter = new SqlServerFormatter();
Not setting SqlFormatter at all, leaving it at its default value
All of them have the same result, only showing #0 but not its value.
If I click the "Share" link, I can see the both the bound parameter name and its value in the resulting JSON array. I just can't see it in the rendered profiler output.
Any ideas what I need to do to show the parameter values?
Answer can be found here : Can MvcMiniProfiler display SQL parameter values?
Add this to Application_Start
MiniProfiler.Settings.SqlFormatter =
new StackExchange.Profiling.SqlFormatters.SqlServerFormatter();
However there seems to be a small issue when using nvarchar / varchar as parameter type. See this topic.
Is there a way to search the Registry for a specific key using Windows Scripting Host?
I'm using JavaScript (Jscript/VBScript?) to do so, and the msdn Library doesn't mention any such method: http://msdn.microsoft.com/en-us/library/2x3w20xf(v=VS.85).aspx
Thanks,
So here's an update to the problem:
The problem is a bit more complicated than a direct registry search. I have to look through the installed products on a windows box, to find a specific product entry that i want to delete. The registry path is defined as:
HKEY_LOCAL_MACHINE\Software\Microsoft...\Products.
Within the Products key, the installed products are listed, but their keys are defined as hash codes. Within the product keys are other keys with defined names and defined values. I want to be able to search on the latter keys and values. How can I do that, by-passing the unknown hash codes?
For example, I need to find a product with DisplayVersion key = 1.0.0. The path to that key is:
HKLM\Software\Microsoft\Windows\CurrentVersion\Installer\UserData\Products\A949EBE4EED5FD113A0CB40EED7D0258\InstallProperties\DisplayVersion.
How can I either pick up, or avoid writing, the product key: A949EBE4EED5FD113A0CB40EED7D0258 ??
Assuming you're using JScript via the Windows Scripting Host (and not JavaScript from a browser) you can get the value of a specific key using the WScript.RegRead method:
// MyScript.js
var key = 'HKEY_CURRENT_USER\\SessionInformation\\ProgramCount'
, wsh = WScript.CreateObject('WScript.Shell')
, val = wsh.RegRead(key);
WScript.Echo('You are currently running ' + val + ' programs.');
If you actually need to search for a key or value based on some conditions rather than a known registry key then you can to implement your own recursive search algorithm where registry values of type "REG_SZ" are leaf nodes.
As an exercise to get more familiar with JScript on the Windows Scripting Host, I've made a small interface to the registry that does exactly this. The example included in the project shows how to perform such a registry search in a WSF script:
<job id="FindDisplayVersions">
<script language="jscript" src="../registry.js"/>
<script language="jscript">
// Search the registry and gather 20 DisplayVersion values.
var reg = new Registry()
, rootKey = 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products'
, keyRegex = /Products\\(.*?)\\InstallProperties\\DisplayVersion$/
, valRegex = /^1\./
, maxResults = 20
, uids = [];
reg.find(rootKey, function(path, value) {
var keyMatch = keyRegex.exec(path);
if (keyMatch) {
if (valRegex.exec(value)) {
uids.push(keyMatch[1] + '\t=\t' + value);
if (uids.length >= maxResults) { return false; } // Stop searching
}
}
return true; // Keep searching.
});
WScript.Echo(uids.join("\n"));
</script>
</job>
Note that, as #Robert Harvey points out, this could take a really long time if the root key is too deeply connected. Simple testing takes only a few seconds on the key I chose but your mileage may vary; of course, no warranty or fitness for a purpose, don't blame me if your computer blows up.
http://code.google.com/p/jslibs/
if you don't find it there, you have to implement it yourself