473,671 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Traceswitch set in web.config not working

WT
Hello,
Using .NET 2 and visual studio 2005 for writting asmx web services.
For asp.net web sites I used to implement trace system using TraceSwitch set
in web.config.
Using
Trace.WireteLin eIf(MySwitch.Tr aceError,"text" );
in my code. Having defined TExtWriterTrace Listener.
But this has no effect and I can't get any tracefile created, is this a
limitation of web services ?
Thanks for help
CS.
Jul 7 '06 #1
4 4500
Trace, when used without qualification in ASP.Net, refers to the Page.Trace
object which is, in reality a System.Web.Trac eContext object.

To use a TraceSwitch, you need to use System.Diagnost ics.Trace. Just
qualify your call to Trace and your TraceSwitch should work.

Dale
--
Dale Preston
MCAD C#
MCSE, MCDBA
"WT" wrote:
Hello,
Using .NET 2 and visual studio 2005 for writting asmx web services.
For asp.net web sites I used to implement trace system using TraceSwitch set
in web.config.
Using
Trace.WireteLin eIf(MySwitch.Tr aceError,"text" );
in my code. Having defined TExtWriterTrace Listener.
But this has no effect and I can't get any tracefile created, is this a
limitation of web services ?
Thanks for help
CS.
Jul 8 '06 #2
Hi,

Thank you for your post.

Based on my understanding, your question is how to use
System.Diagnost ics.Trace in ASP.NET web application. If I've misunderstood
anything, please feel free to post here.

In order for the trace to take effect, you need to recompile your
application with the trace flag set. You do that by setting the
compilerOptions attribute to ="/d:TRACE" in the configuration line for the
language compiler you want to support tracing. Other than configuration
<system.diagnos ticsin web.config, you also need to modify the compiler
switch to enable trace flag:

<system.codedom >
<compilers>
<compiler language="c#;cs ;csharp"
extension=".cs"
compilerOptions ="/d:TRACE"
......

For more information, please refer to following MSDN Library article:

#Walkthrough: Integrating ASP.NET Tracing with System.Diagnost ics Tracing
http://msdn2.microsoft.com/en-us/library/b0ectfxd.aspx

Hope this helps. Please feel free to post here if anything is unclear.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.
Jul 10 '06 #3
WT
Thanks Walter, we discovered finally thta it is working.
We were using a bad directory for our tracefile, ACL were missing for the
web service account.

We have now a different problem, when we expect one tracefile nammed
MyTrace.log, we get it ....and several other files with names prefixed with
a Guid like number followed byè our tracefile name, just like
951316786532187 9632Mytrace.log

Why asp.net is generating theses files ?

Thanks for help.
"Walter Wang [MSFT]" <wa****@online. microsoft.coma écrit dans le message
de news: 9f************* *@TK2MSFTNGXA01 .phx.gbl...
Hi,

Thank you for your post.

Based on my understanding, your question is how to use
System.Diagnost ics.Trace in ASP.NET web application. If I've misunderstood
anything, please feel free to post here.

In order for the trace to take effect, you need to recompile your
application with the trace flag set. You do that by setting the
compilerOptions attribute to ="/d:TRACE" in the configuration line for the
language compiler you want to support tracing. Other than configuration
<system.diagnos ticsin web.config, you also need to modify the compiler
switch to enable trace flag:

<system.codedom >
<compilers>
<compiler language="c#;cs ;csharp"
extension=".cs"
compilerOptions ="/d:TRACE"
......

For more information, please refer to following MSDN Library article:

#Walkthrough: Integrating ASP.NET Tracing with System.Diagnost ics Tracing
http://msdn2.microsoft.com/en-us/library/b0ectfxd.aspx

Hope this helps. Please feel free to post here if anything is unclear.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

Jul 11 '06 #4
Hi,

Thank you for your update.

I'm sorry I didn't mentioned that when the ASP.NET worker process is
running under a service account, that account will be used to access the
log file. Anyway, I'm glad you've figured that out, I'm sure your
experience will benefit the community a lot. Thank you for your effort!

As for the tracefile name gets changed, I was unable to reproduce the
problem here, would you please telling me more details such as the
web.config and your code to write log? Thank you!

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.
Jul 12 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1277
by: Kevin Meiresonne | last post by:
I have developed an XML-based tracelistener which uses a booleanswitch (enable/disable), a general traceswitch (set the tracelevel) and a userspecific traceswitch (set the tracelevel for a particular user). Those switches are set in app.config Now I am looking for a way to know when these settings in my app.config have changed (for example, when changing the tracelevel) at runtime, so that my application can use the new settings. When...
0
1156
by: emy | last post by:
hello and hye everyone... can i know whether a .dll can read from traceswitch configuration file.I tried for windows application and it work well..because as far as i read, class library(.dll)cannot read from configuration file.So how about traceswitch. thank you
2
2553
by: nhmark64 | last post by:
Hi, When i run testapp.exe the testapp.exe.config file i have in the DEBUG directory gets deleted, and the TraceSwitch in my code never gets set. testapp.exe.config ____________________ <?xml version="1.0" encoding="utf-8"?> <configuration>
2
2233
by: PMac | last post by:
I'm trying to execute a stand-alone console application from an aspx page when a use clicks a button on that page. On the aspx page is the following lines of pertinent code: private void btnStartApp(object sender, System.EventArgs e) { Process procID; string procName; ProcessStartInfo psi = new ProcessStartInfo();
1
3401
by: David | last post by:
I am attempting to use "TraceSwitch " in Win Forms (Below is the code and the app.config). According to the manual, the program should read the config for the setting, but this is not occurring. The examples in the SDK and on the web appear to match mine, but I am not sure if there is an error with my code or some additional setting. ==== The code is:
13
507
by: Khodr | last post by:
Hello, I am using VS.NET 2003 and vb. I build my application MyApp and it generates MyApp.exe.config. So now MyApp.exe reads parameters from MyApp.exe.config. Great and no problem! I need to run the same program but with different configuration data. So I made a copy of MyApp.exe and MyApp.exe.config to put them in another folder and renamed the copy to MyApp2.exe and MyApp2.exe.config respectively. I ran it but it did not read from...
0
1101
by: PhilipDaniels | last post by:
I'm trying to create a tracing system for my application. I want to create a new type of Switch that is basically TraceSwitch with an extra attribute called "includeMethodName". So my application's config file should look like this, for example: <configuration> <system.diagnostics> <switches> <add name="FirstSwitch" value="1" includeMethodName="1" /> <add name="SecondSwitch" value="1" includeMethodName="1" />
3
10592
by: Blasting Cap | last post by:
I am working on a web app that I want to be able to use a separate config file on, in addition to the web.config file that's already working in the application. If I put the following in the web.config file (VS 2005, Framework 2.0), I can retrieve the values fine: <appSettings> <add key="fileInputFolder" value="C:\National City Downloads\test"/> <add key="fileTransaction" value="\Transactions\"/>
5
2854
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I have a app that uses several membership/role providers. I can list these Providers with the code: Dim rootWebConfig1 As Configuration rootWebConfig1 = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath) Dim section As New MembershipSection section = rootWebConfig1.GetSection("system.web/membership")
0
8472
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8909
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8819
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8596
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8667
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4221
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4399
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2048
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.