IIS - AppPool StartMode changing by itself - c#

On my developer machine, amongst my 10 websites and their respective application pools, three of them are very frequently getting setted to startMode = Always running.
I have to reset them to OnDemand regularly and I cannot find the root cause of this.
Apps are coded in C# using .Net5 and hosted on IIS 10
Below is an exemple log from the Event Logs showing the change
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-IIS-Configuration" Guid="{dc0b8e51-4863-407a-bc3c-1b479b2978ac}" />
<EventID>29</EventID>
<Version>0</Version>
<Level>5</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x4000000000000000</Keywords>
<TimeCreated SystemTime="2022-06-20T15:25:46.2192842Z" />
<EventRecordID>5</EventRecordID>
<Correlation />
<Execution ProcessID="10120" ThreadID="10800" />
<Channel>Microsoft-IIS-Configuration/Operational</Channel>
<Computer>LAP-PLS</Computer>
<Security UserID="S-1-5-21-2179824267-3666241482-379869353-1001" />
</System>
<EventData>
<Data Name="PhysicalPath">\\?\C:\WINDOWS\system32\inetsrv\config\applicationHost.config</Data>
<Data Name="ConfigPath">MACHINE/WEBROOT/APPHOST</Data>
<Data Name="EffectiveLocationPath" />
<Data Name="Configuration">/system.applicationHost/applicationPools/add[#name="XXXX"]/#startMode</Data>
<Data Name="EditOperationType">3</Data>
<Data Name="OldValue">OnDemand</Data>
<Data Name="NewValue">AlwaysRunning</Data>
</EventData>
</Event>
This is driving me crazy and help would me much appreciated
Thanks,

Related

Tizen.NET NfcCardEmulation throws UnsupportedException (with added privileges)

I had a issue with a Tizen.NET Api v4. Generally i need cardemulation in the watch, but while executing static method
NfcManager.GetCardEmulationAdapter()
i am gettings logs
tizen-manifest.xml looks like (and he was generating by vs2019 with Tizen ext)
<?xml version="1.0" encoding="utf-8"?>
<manifest package="tizenapp" version="1.0.1" api-version="4" xmlns="http://tizen.org/ns/packages">
<profile name="wearable" />
<ui-application appid="tizenapp" exec="tizenapp.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single">
<label>tizenapp</label>
<icon>tizenapp.png</icon>
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
<splash-screens />
</ui-application>
<shortcut-list />
<privileges>
<privilege>http://tizen.org/privilege/secureelement</privilege>
<privilege>http://tizen.org/privilege/nfc</privilege>
<privilege>http://tizen.org/privilege/nfc.cardemulation</privilege>
<privilege>http://tizen.org/feature/network.nfc.card_emulation</privilege>
<privilege>http://tizen.org/feature/network.nfc</privilege>
</privileges>
<dependencies />
<provides-appdefined-privileges />
<feature name="http://tizen.org/feature/network.nfc">true</feature>
<feature name="http://tizen.org/feature/network.nfc.card_emulation">true</feature>
<feature name="http://tizen.org/feature/network.secure_element">true</feature>
<feature name="http://tizen.org/feature/network.secure_element.ese">true</feature>
<feature name="http://tizen.org/feature/network.secure_element.uicc">true</feature>
</manifest>
I dont know what i need to fix this problems.
It looks like a simple typo in the implementation. It's fixed in API5 and later.
https://github.com/Samsung/TizenFX/pull/578/files
I'm not sure if there's any workaround for this when targetting for API4, because it's not about a privilege but a feature.

keep getting ERR.SWS.CLIENT.VALIDATION_FAILED exception when calling PassengerDetailsRQ

I am using Sabre SOAP Api in C#. I got the response from session creation successfully, I added wsdl Service Reference
http://files.developer.sabre.com/wsdl/sabreXML1.0.00/ServicesPlatform/PassengerDetails3.3.0RQ.wsdl to my test project and pass required values to parameters in the request as given in the documentation https://developer.sabre.com/docs/read/soap_apis/management/itinerary/Passenger_Details.
this is my xml to that is send to sabre and Getting Exception
<?xml version="1.0" encoding="utf-16"?>
<PassengerDetailsRQ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="2.2.1"
IgnoreOnError="false">
<MiscSegmentSellRQ xmlns="http://services.sabre.com/sp/pd/v3_2">
<MiscSegment DepartureDateTime="2018-01-10T16:45" InsertAfter="0" NumberInParty="1" Status="HK" Type="OTH">
<OriginLocation LocationCode="SAN" />
<Text>America Tours</Text>
<VendorPrefs>
<Airline Code="DL" />
</VendorPrefs>
</MiscSegment>
</MiscSegmentSellRQ>
<PostProcessing xmlns="http://services.sabre.com/sp/pd/v3_2">
<EndTransactionRQ>
<EndTransaction Ind="true">
<Email Ind="true" />
</EndTransaction>
<Source ReceivedFrom="SWS TESTING" />
</EndTransactionRQ>
</PostProcessing>
<PreProcessing xmlns="http://services.sabre.com/sp/pd/v3_2" />
<PriceQuoteInfo xmlns="http://services.sabre.com/sp/pd/v3_2">
<Link NameNumber="1.1" Record="1" />
</PriceQuoteInfo>
<SpecialReqDetails xmlns="http://services.sabre.com/sp/pd/v3_2">
<SpecialServiceRQ>
<SpecialServiceInfo>
<SecureFlight>
<PersonName DateOfBirth="02/02/1998" NameNumber="1.1">
<GivenName>Usama QW</GivenName>
<Surname>Alam</Surname>
</PersonName>
<VendorPrefs>
<Airline />
</VendorPrefs>
</SecureFlight>
</SpecialServiceInfo>
</SpecialServiceRQ>
</SpecialReqDetails>
<TravelItineraryAddInfoRQ xmlns="http://services.sabre.com/sp/pd/v3_2">
<AgencyInfo>
<Address>
<AddressLine>America Tours</AddressLine>
<CityName>Los Angeles</CityName>
<CountryCode>US</CountryCode>
<PostalCode>90020</PostalCode>
<StateCountyProv StateCode="CA" />
<StreetNmbr>3434 West 6th Street Suite 400-6</StreetNmbr>
</Address>
<Ticketing TicketType="7T-A" />
</AgencyInfo>
<CustomerInfo>
<ContactNumbers>
<ContactNumber NameNumber="1.1" Phone="213-738-8185" PhoneUseType="A" />
<ContactNumber NameNumber="1.1" Phone="3162881034" PhoneUseType="A" />
</ContactNumbers>
<Email Address="www.usamaalam60#gmail.com" ShortText="AmericaTours" />
<Email Address="admin#koreaonly.com" ShortText="AmericaTours" />
<PersonName NameNumber="1.1" NameReference="MR" PassengerType="ADT">
<GivenName>Usama sd</GivenName>
<Surname>Alam</Surname>
</PersonName>
</CustomerInfo>
</TravelItineraryAddInfoRQ>
</PassengerDetailsRQ>
For this one you seem to be using invalid service version for the 3.2 namespace. Try with something like this:
*xmlns="http://services.sabre.com/sp/pd/v3_2"* and *version="3.2.0"*.
You were using version 2.2.1 here which will require a different URL.
Are you intending to use 3.2.0 version? I can see that the dates are not valid as per the schema as well. You have:
*DateOfBirth="02/02/1998"*
but should have:
*DateOfBirth="1998-02-02"*

ETW Channel Providers - Channel Names

I am using latest EventSource Nuget-Package for creating eventlogs where every application gets its own folder for different types of logs.
As playing around I figured out that I can't simply change the logs name.
I tried to change it in the manifest file and registered the new channel where it displayed its new name. Unfortunately every event fired to these logs won't show up anymore till I register a new channel with predefined channel name.
Any chance to change that? Since I have to create manifest files on each machine i have to change it programatically because channel names were created by predefined values (Admin, Operational, etc...)
To be clear: I want to change following names AND have all logs written into these channels.
Sample-manifest which was generated automatically:
<instrumentationManifest xmlns="http://schemas.microsoft.com/win/2004/08/events">
<instrumentation xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:win="http://manifests.microsoft.com/win/2004/08/windows/events">
<events xmlns="http://schemas.microsoft.com/win/2004/08/events">
<provider name="Samples-EventSourceDemos-EventLog" guid="{d89ec17d-ee69-5275-eb6f-0c826bb76bd8}" resourceFileName="E:\EventlogTest\bin\Debug\EventlogTest.Samples-EventSourceDemos-EventLog.etwManifest.dll" messageFileName="E:\EventlogTest\bin\Debug\EventlogTest.Samples-EventSourceDemos-EventLog.etwManifest.dll" symbol="SamplesEventSourceDemosEventLog">
<channels>
<channel chid="Admin" name="Samples-EventSourceDemos-EventLog/Admin" value="16" type="Admin" enabled="true"/>
<channel chid="Analytic" name="Samples-EventSourceDemos-EventLog/Analytic" value="18" type="Analytic" enabled="false"/>
<channel chid="Debug" name="Samples-EventSourceDemos-EventLog/Debug" value="19" type="Debug" enabled="false"/>
</channels>
<tasks>
<task name="Request" message="$(string.task_Request)" value="1"/>
<task name="DebugTrace" message="$(string.task_DebugTrace)" value="65530"/>
</tasks>
<opcodes>
</opcodes>
<keywords>
<keyword name="Requests" message="$(string.keyword_Requests)" mask="0x1"/>
<keyword name="Debug" message="$(string.keyword_Debug)" mask="0x2"/>
<keyword name="Session3" message="$(string.keyword_Session3)" mask="0x100000000000"/>
<keyword name="Session2" message="$(string.keyword_Session2)" mask="0x200000000000"/>
<keyword name="Session1" message="$(string.keyword_Session1)" mask="0x400000000000"/>
<keyword name="Session0" message="$(string.keyword_Session0)" mask="0x800000000000"/>
</keywords>
<events>
<event value="1" version="0" level="win:Error" symbol="RequestStart" message="$(string.event_RequestStart)" keywords="Requests" opcode="win:Start" task="Request" channel="Admin" template="RequestStartArgs"/>
<event value="2" version="0" level="win:Error" symbol="RequestPhase" message="$(string.event_RequestPhase)" keywords="Requests" task="Request" channel="Analytic" template="RequestPhaseArgs"/>
<event value="3" version="0" level="win:Error" symbol="RequestStop" message="$(string.event_RequestStop)" keywords="Requests" opcode="win:Stop" task="Request" channel="Admin" template="RequestStopArgs"/>
<event value="4" version="0" level="win:Error" symbol="DebugTrace" message="$(string.event_DebugTrace)" keywords="Debug" task="DebugTrace" channel="Debug" template="DebugTraceArgs"/>
</events>
<templates>
<template tid="RequestStartArgs">
<data name="RequestID" inType="win:Int32"/>
<data name="Url" inType="win:UnicodeString"/>
</template>
<template tid="RequestPhaseArgs">
<data name="RequestID" inType="win:Int32"/>
<data name="PhaseName" inType="win:UnicodeString"/>
</template>
<template tid="RequestStopArgs">
<data name="RequestID" inType="win:Int32"/>
</template>
<template tid="DebugTraceArgs">
<data name="Message" inType="win:UnicodeString"/>
</template>
</templates>
</provider>
</events>
</instrumentation>
<localization>
<resources culture="de-DE">
<stringTable>
<string id="event_DebugTrace" value="DebugMessage: %1"/>
<string id="event_RequestPhase" value="Entering Phase %2 for request %1"/>
<string id="event_RequestStart" value="Start processing request%n%t*** %1 ***%nfor URL%n%t=== %2 ==="/>
<string id="event_RequestStop" value="Stop processing request%n%t*** %1 ***"/>
<string id="keyword_Debug" value="Debug"/>
<string id="keyword_Requests" value="Requests"/>
<string id="keyword_Session0" value="Session0"/>
<string id="keyword_Session1" value="Session1"/>
<string id="keyword_Session2" value="Session2"/>
<string id="keyword_Session3" value="Session3"/>
<string id="task_DebugTrace" value="DebugTrace"/>
<string id="task_Request" value="Request"/>
</stringTable>
</resources>
</localization>
</instrumentationManifest>
Thanks for your help.

Why is svchost.exe terminating my C# application?

For some reason, my C# application is being terminated by svchost.exe and I'm trying to understand why. It was terminating the application silently until I turned on Silent Process Exit logging using Gflags.exe from the Windows Debugging Tools. It happens infrequently on machines that I can't running debugging tools on (customer pcs).
The event doesn't really provide me with much info to go on. The termination code is 805306369=0x30000001, but I can't seem to find anything useful online that would tell me how to interpret that number.
I was hoping that the Silent Process Exit log would shed some light on this, but now I just have more questions.
Any advice would be appreciated. Thanks for your help in advance!
Here is the event in question:
Log Name: Application
Source: Microsoft-Windows-ProcessExitMonitor
Date: 06/05/2013 04:12:17 PM
Event ID: 3001
Task Category: None
Level: Information
Keywords: Classic
User: SYSTEM
Computer: PC
Description:
The process 'C:\Users\Administrator\AppData\Local\MyApp.exe' was terminated by the process 'C:\Windows\System32\svchost.exe' with termination code -805306369. The creation time for the exiting process was 0x01ce61ad4e81c70c.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-ProcessExitMonitor" Guid="{FD771D53-8492-4057-8E35-8C02813AF49B}" EventSourceName="Process Exit Monitor" />
<EventID Qualifiers="16384">3001</EventID>
<Version>0</Version>
<Level>4</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2013-06-05T20:12:17.000000000Z" />
<EventRecordID>2350</EventRecordID>
<Correlation />
<Execution ProcessID="0" ThreadID="0" />
<Channel>Application</Channel>
<Computer>PC</Computer>
<Security UserID="xxxxx" />
</System>
<EventData Name="EVENT_PROCESSTERMINATION_CROSSPROCESS">
<Data Name="param1">C:\Users\Administrator\AppData\Local\MyApp.exe</Data>
<Data Name="param2">C:\Windows\System32\svchost.exe</Data>
<Data Name="param3">-805306369</Data>
<Data Name="param4">01ce61ad4e81c70c</Data>
</EventData>
</Event>

//#attrib vs //name/#attrib in C#

On the XML below, I'm using the SelectSingleNode of XmlDocument to pull out the result value.
evtASxml.SelectSingleNode(#"//#value").Value
returns the value of the first "value."
evtASxml.SelectSingleNode(#"//Result/#value").Value
raises a null exception.
Could someone explain what's going on?
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-CAPI2" Guid="{f00f00-f00-f00f00-f00-f00f00f00}" />
<EventID>30</EventID>
<Version>0</Version>
<Level>2</Level>
<Task>30</Task>
<Opcode>0</Opcode>
<Keywords>0x4000000000000001</Keywords>
<TimeCreated SystemTime="2012-04-08T23:43:37.573242200Z" />
<EventRecordID>4828</EventRecordID>
<Correlation ActivityID="{f00f00-f00-f00-f00-f00f00f00f00}" />
<Execution ProcessID="7512" ThreadID="3220" />
<Channel>Microsoft-Windows-CAPI2/Operational</Channel>
<Computer>Matt-Seven</Computer>
<Security UserID="S-f00-f00-f00-f00f00f00-f00f00f00-f00f00f00-f00f00" />
</System>
<UserData>
<CertVerifyCertificateChainPolicy>
<Policy type="CERT_CHAIN_POLICY_SSL" constant="4" />
<Certificate fileRef="f00f00f00f00f00f00f00f00f00f00f00.cer" subjectName="www.example.com" />
<CertificateChain chainRef="{f00f00-f00-f00-f00-f00f00f00f00}" />
<Flags value="0" />
<SSLAdditionalPolicyInfo authType="server" serverName="example.com">
<IgnoreFlags value="0" />
</SSLAdditionalPolicyInfo>
<Status chainIndex="0" elementIndex="0" />
<EventAuxInfo ProcessName="iexplore.exe" />
<CorrelationAuxInfo TaskId="{f00f00-f00-f00-f00-f00f00f00f00}" SeqNumber="4" />
<Result value="800B010F">The certificate's CN name does not match the passed value.</Result>
</CertVerifyCertificateChainPolicy>
</UserData>
</Event>
Numeric values from my event log replaced with f00.
Just guessing, but I think you want //*[#value], and not //#value
The reason for this problem is that the XML document is in a default namespace.
Selecting elements by name when they are in a default namespace is the most FAQ in XPath.
Xpath treats any unprefixed element name as belonging to "no namespace". In your case no Result element exists that is in "no namespace" (all elements are in the "http://schemas.microsoft.com/win/2004/08/events/event" namespace) and thus no node is selected.
In C# it is recommended that you provide an XmlNamespaceManager as the second argument of SelectSingleNode() -- just use the appropriate overload.
Use:
evtASxml.SelectSingleNode(#"//x:Result/#value", yourXmlNamespaceManager).Value
where the association of "x" to the "http://schemas.microsoft.com/win/2004/08/events/event" namespace has been added to yourXmlNamespaceManager using the AddNamespace() method.

Categories