|
Here's a new wrinkle... I put the code on a non dev machine and get the same results. Does anyone have any explaination to this behavior, because the only conclusion I can come to is that it's some kind of default?
Thanks.
|
|
|
|
|
Look in your web.config file. You'll find the "default" value in there.
|
|
|
|
|
There isn't any file. This is what happens when I just instantiate a configuration class object and then do an OpenExeConfiguration and specify a path. The HasFile property is set to false, which it should, since there isn't actually a file, but that this is all in memory. When I save the configuration it puts no connectionsettings section in the config file.
When I add a new setting on my own and then save it, it then saves only my setting and ignores the "default" setting. Is there a base config file someplace I should be looking at that settings are getting incorporated from also? This isn't a web application, but a workstation app.
|
|
|
|
|
OK. If there isn't any file, why are you using the ConfigurationManager??
There IS a default inherited ConnectionStringSetting in the ConfigurationManager, regardless if there is a config file or not. This is comming from the machine.config and machine.default files in C:\WINDOWS\Microsoft.NET\Framework\<version>\CONFIG .
To tell your COnfigurationManager to forget about the inherited connectionstrings, create a config file in your app and add your connection string like this:
<?xml version="1.0" encoding="utf-8" ?>
.
. blah, blah, blah...
.
<connectionStrings>
<clear/>
<add name="myConnectiongStringName" providerName="System.Data.SqlClient" connectionString= "blah;blah;blah;" />
</connectionStrings>
The clear/ line will tell the ConfigurationManager to dump all of the ConnectionStringSetting boject it currently has, including the default one, and build a new collection from the rest of the connectionStrings section.
|
|
|
|
|
I was using the ability of the save method in the configuration class to save the memory version to file. The exmples I've seen use the configurationmanager to get the object of the configuration class since it has no constructors. If there is another method for getting a configuration class instance I'd certainly like to know about it.
Well, the machine.config file certainly explains it then.
Thanks
|
|
|
|
|
Thanks! I didn't know about this.
|
|
|
|
|
That setting should be in the machine.config file or the root web.config file in the framework directory.
Look in c:\windows\microsoft.net\framework\"pick your framework version"\configuration
Hope that helps.
Ben
|
|
|
|
|
My setup project is already installed on my system.I am rebuilding it without doing any modification.If I double clicks my installer package it shows the message that "some version of product is already there".
What can be the issue?
Actually I am installing some some project output files through this setup project. I just want to install the output files which i have updated.It is of no use to uninstall full project and again install it.
Is it possible to customize my progress dialog box in userinterface Editor.I need the functionality at installation time that shows which component is getting installed at that particular time.I want to display some label on progress dialog box which will show that information.I am not finding any property like that with dialog box.
Thanks in advance,
Mann
|
|
|
|
|
can anyone recommend a book(s) that provides in depth coverage of .NET components, service providers etc. Preferably one that move beyond the developers perspective, i.e. recognises that folks in banks, hospitals etc, don't use an IDE to manage loans or schedule surgical staff rosters.
|
|
|
|
|
Hi
I am trying to index folders that are located in network in the MS Indeing server in ASP.Net c#. But when i call the method AddScope() providing the sharename ,folder path and the credentials it gives following exception:
System.Runtime.InteropServices.COMException (0x8004160A): Exception from HRESULT: 0x8004160A
at CIODMLib.ICatAdm.AddScope(String bstrScopeName, Boolean fExclude, Object vtLogon, Object vtPassword)
could you please tell what this exception about and how can i remove this to attain the desired functionality.
-- modified at 4:04 Wednesday 9th May, 2007
Manoj Kaushik
|
|
|
|
|
Can anyone tell me if Thread.Sleep releases the thread to process other requests? Or does it hold that thread up until it re-activates.
I read somewhere it frees the processor for other things, but can't remember for the life of me where.
Cheers
Tris
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
Thread.Sleep() blocks the current thread, so that cannot do any more processing for the specified time period, however due to the windows process scheduler other threads keep running (it doesn't hang the whole PC).
Wilco
|
|
|
|
|
Hi Wilco, thanks.
I know the thread is 'blocked' but does the CLR scheduler move the resources from that thread to another one to allow another thread to continue in place of the one that has just been blocked.
The reason i ask is that i'd like to use the Async DbExecute method with Thread.Sleep, but it would be completely pointless if it doesn't allow the underlying processor time to switch in the background to another thread for the duration of the sleep.
Cheers
T
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
it hold that thread up until it re-activates
either in win or web
already in web the processor works parellarly with all client requests
it works in one page for a while and for example opens the DB connection and waiting data back in that stage it goes to another page and work and then get back to the first to continue when the databack then finish and goes to the second page to continue
this is more advanced technique than thread stop
the iis server who evaluates at which stage of code the processor can go to work in another page
|
|
|
|
|
So the thread simply gives up it's time slice to other waiting threads in the pool?
Cheers
Tris
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
|
Thanks Colin,
One more thing -
Would it be efficient to do something along these lines:
<br />
SqlCommand.BeginInvoke(flags, callback)<br />
<br />
do<br />
{<br />
Thread.Sleep(0);
}while(cmdResponse == null)<br />
<br />
return cmdResponse<br />
And that should free up the db wait time for other requests?
Cheers
Tris
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
Tristan Rhodes wrote: Would it be efficient to do something along these lines:
I'm presuming that cmdResponse will be set in the callback method on the other thread.
Tristan Rhodes wrote: And that should free up the db wait time for other requests?
What other requests? If my assumption is correct, you have taken an asynchonous request and effectively turned it back in to a synchronous request by waiting for the call back function to return.
Now, if you were to do something between the BeginInvoke and waiting for the call back method to populate cmdResponse then there might be some point.
When you are waiting for a database call to return from the server the thread will be blocked and the scheduler will skip past it until something is available for it to do.
|
|
|
|
|
I'm intrigued by the mechanics for this.
Clearly there is going to be a wait for the database response to process and return, and i'd like other threads to use that time instead of the current thread. I've been lead to believe that by performing a standard non async query, the thread is locked and not shared leading to a performance hit with lots of concurrent request, whilst performing a thread.sleep would enable it to be freed up and process other requests whilst waiting for the DB to response. In which case, wrapping an async operation in a Sleep loop would give up the thread whilst waiting for a response.
But i'm guessing i've got the wrong end of the stick. Where have i gone wrong?
Cheers
T
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
Tristan Rhodes wrote: Clearly there is going to be a wait for the database response to process and return, and i'd like other threads to use that time instead of the current thread.
The thread will block while it waits for the network response. Just as it will block if it is waiting for a disk read and so on. While the thread is blocked the OS will switch to the next available highest priority non-blocked thread. The OS will not attempt to run blocked threads. So blocked threads will not take up processor time.
Tristan Rhodes wrote: the thread is locked and not shared leading to a performance hit with lots of concurrent request
Locking is a different issue.
Locking relates to resources. For example, if you are performing an update on an object that takes several lines of code the OS can interupt the operation and swap in a different thread (or the other thread may be running on a separate processor or core). Either way, while you are making the update you want to lock out any other changes so that your object remains in a consistent state. When you lock the object you block other threads from locking it at the same time.
If a thread attempts to lock an object that is already locked its will be blocked, the OS will move on to the next thread (the highest priority non-blocked thread). When the first thread releases the lock the second thread can then aquire it. For obvious reasons a lock should be aquired and released as quickly as possible, you don't want to block other threads too long.
Tristan Rhodes wrote: a thread.sleep would enable it to be freed up and process other requests whilst waiting for the DB to response
The thread will block anyway while waiting for the result set to return. You are just implementing what is already taken care of in the OS - and less efficiently because you continually wake up and perform a check then go back to sleep again. The synchronous database request will just wait (i.e. It will be blocked) until something is available or the operation times out.
Tristan Rhodes wrote: Where have i gone wrong?
By the looks of it confusing locking with blocking. I hope this has explained enough that you've got a better handle on the situation.
|
|
|
|
|
Sorry, i missused Lock in my last post, i know the difference.
Could you explain the benefits of using the Asynchronous PageLoad model in asp.net if, when waiting for requests from the database, the thread can process other incoming requests?
Cheers
T
Edit: Alternatively a good article will do. In the mean time, i will re-read the MS article on async programming model when i'm not so tired.
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
Hi!
I'm currently writing a poker program i .net compact framework. In one method I have a while-loop that goes through every player until everyone is finished betting. What I need is some way to halt the while-loop until the user makes a decision (presses a key) and then continue. How can I do this?
Thanks!
|
|
|
|
|
Have a Timer Control with Enabled = false.
Place the code that you wants to execute in the Timer_Tick Event .
Enable the Timer when the user press a key(In the Key Down event).
Hope hat helps you.
Regards,
Arun Kumar.A
|
|
|
|
|
If i have total markup (XAML) based workflow, how do i refer some property/variable defined in my XAML inside rule file?
I know how we can do this using code, but i want to do this for pure XAML based workflows.
Any hints or examples would be appreciated.
Muhammad Shoaib Khan
http://geocities.com/lansolution
|
|
|
|
|
hi i am currently doing remoting in c#.net window application my server codes is below
i would like to ask if there i can put an event handler (function)
which will execute when there is an incoming request from the client
reason: as i need to reload the form when also populate one of the text box in the form when the request comes in
thx for reading
and hope you can help me pls
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
using System.Runtime.Remoting;<br />
using System.Runtime.Remoting.Channels;<br />
using System.Runtime.Remoting.Channels.Tcp;<br />
<br />
namespace WindowsApplication2<br />
{<br />
public partial class Form1 : Form<br />
{<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
}<br />
<br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
TcpChannel channel = new TcpChannel(8080);<br />
ChannelServices.RegisterChannel(channel);<br />
<br />
RemotingConfiguration.RegisterWellKnownServiceType(<br />
typeof(ClassLibrary1.Class1),<br />
"HelloWorld",<br />
WellKnownObjectMode.SingleCall);<br />
}<br />
}<br />
}
|
|
|
|