I'm trying to execute the following command at the start of an Azure web role to set a specific time in which the app pool will be recycled:
%windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.recycling.periodicRestart.schedule.[value='00:08:00']
But when I to do this I get the error:
ERROR ( messsage:Cannot find requested collection element. )
Anyone know how to use appcmd to set default application pool settings to make it recycle at 8:00 AM UTC? Note that the collection of specific times the app pool recycles is empty initially.
I restart application pools after periods of time, not at certain times of the day. Although your attempt suggests you are kind of doing the same? But that would suggest you are attempting to restart the app pool every 8 minutes? Anyway This is what I use:
appcmd set apppool /apppool.name: string /recycling.periodicRestart.time: ' timeSpan '
Where string is the application pool name and timeSpan is d.hh:mm:ss.
Working Example to restart the defaultapplicationpool every 30 minutes in IIS7:
appcmd set apppool /apppool.name: defaultapplicationpool /recycling.periodicRestart.time: 00:30:00
EDIT
In light of your comment can you not just do this?
appcmd set apppool /apppool.name: string /+recycling.periodicRestart.schedule.[value=' timeSpan ']
EDIT 2
Example of Default App Pool to recycle daily at 00:08am
appcmd set apppool /apppool.name: DefaultAppPool /+recycling.periodicRestart.schedule.[value='00:08:00']
I was able to configure it with applicationPoolDefaults like this:
appcmd set config -section:system.applicationHost/applicationPools "/+applicationPoolDefaults.recycling.periodicRestart.schedule.[#0,value='08:00:00']" /commit:apphost
Related
I created a basic web MVC app in vs 2017 and tried to publish it on Azure.
Tried to use existing app service and created a new as well, but both failed.
Received this error -
Severity Code Description Project File Line Suppression State
Error Web deployment task failed. ((20-Jun-19 12:40:32 PM) An error occurred when the request was processed on the remote computer.)
(20-Jun-19 12:40:32 PM) An error occurred when the request was processed on the remote computer.
There is an unclosed literal string. Line 1, position 70.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char quoteChar, NodeData attr)
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XPath.XPathDocument.LoadFromReader(XmlReader reader, XmlSpace space)
at System.Xml.XPath.XPathDocument..ctor(TextReader textReader)
at Microsoft.Web.Deployment.PackageDeserializer..ctor(Stream stream, DeploymentBaseContext baseContext)
at Microsoft.Web.Deployment.DeploymentAgent.HandleSync(DeploymentAgentAsyncData asyncData, Nullable`1 passId, String user, String siteName) WebApplicationForAzure 0
To start with, kindly check to see if the app works fine locally.
A deployment issue is an issue that causes the wrong set of files to get deployed to your site folder (typically site\wwwroot), or that causes some files not to get deployed at all.
A runtime issue happens when the files in your wwwroot folder are exactly what they should be, but for some reason the site doesn't run correctly.
Make sure site correctly deploys locally for isolating the issue. Are you deploying to staging slots?
Set WEBSITE_WEBDEPLOY_USE_SCM=false in the Application settings from the Azure Portal, re-download the publish profile and then re-try to see if that helps.
Navigate to your problematic app in the Azure Portal.
Go to Configuration settings blade.
Under Application Settings, set WEBSITE_WEBDEPLOY_USE_SCM = false
Ensure that the ‘false’ key is in the value field.
Reset and re-download the publish settings again in VS.
Also, isolate to see if it is due to network proxy or port on your system.
I have the following chunk of code in a .NET web app used to query AD for a user
using (DirectoryEntry de = new DirectoryEntry(ldap))
{
using (DirectorySearcher adSearch = new DirectorySearcher(de))
{
adSearch.Filter = "(&(objectCategory=person)(objectClass=user)(samAccountName=username))";
SearchResult adSearchResult = adSearch.FindOne();
}
}
When I run this, I sometimes get the following error:
System.Runtime.InteropServices.COMException (0x80005000): Unknown
error (0x80005000) at
System.DirectoryServices.DirectoryEntry.Bind(Boolean throwIfFail)
at System.DirectoryServices.DirectoryEntry.Bind() at
System.DirectoryServices.DirectoryEntry.get_AdsObject() at
System.DirectoryServices.DirectorySearcher.FindAll(Boolean
findMoreThanOne) at
System.DirectoryServices.DirectorySearcher.FindOne()
When this error is being thrown, it errors every time it runs. To correct this, I have to go to the IIS App Pool associated with this web app and recycle it. After recycling, the code works ... for a period of time. Then the error comes back a few hours later.
Additional information to note:
The App Pool is still running when it errors. Still, recycling
fixes it
I have this same code running on 2 different web servers that are identically configured. This issue occurs on the first web server but
never on the second
The App Pool is running under an AD service account. The same account is used on the app pool of both servers
I have tried recreating the App Pool associated with this web app without success
I would greatly appreciate any suggestions on where to look in IIS for a permanent solution. I can't be recycling the app pool every few hours.
Thanks
I have an Azure Web Job, and currently the function iself will always complete with a success. However the job itself fails with this error:
[11/26/2016 07:12:11 > 462baa: ERR ] Command 'cmd /c ""MyJob.Webjob ...' was aborted due to no output nor CPU activity for 121 seconds. You can increase the SCM_COMMAND_IDLE_TIMEOUT app setting (or WEBJOBS_IDLE_TIMEOUT if this is a WebJob) if needed.
cmd /c ""MyJob.Webjob.StuffJob.exe""
[11/26/2016 07:12:11 > 462baa: SYS INFO] Status changed to Failed
What can I do once my function is complete to let the job know it's done instead of sitting idle and timing out?
Here is my Functions' class method. Everything runs fine, but it doesn't properly stop and I don't know how to tell the job when I'm done.
[NoAutomaticTrigger()]
public void ProcessLoanOriginationDocuments(TextWriter log)
{
try
{
log.WriteLine("Starting Job");
_service.DoSomething();
log.WriteLine("Ending Job");
}
catch (Exception ex)
{
log.WriteLine(ex.Message);
}
}
What can I do once my function is complete to let the job know it's done instead of sitting idle and timing out?
From my experience, we need to set the WEBJOBS_IDLE_TIMEOUT value enough large to let the WebJob be executed completely.
From your description, the azure WebJob stopped may be caused by a website in idle. Please have a try to troubleshoot as following ways:
Set the website “Always On”
"Always On" is not supported if WebApp is in a free Service Plan tier. If the WebApp is in a free tier, please scale up the App Service Plan. Please refer to the document for more info about how to scale up the App Service Plan.
Add the WEBJOBS_IDLE_TIMEOUT in the Azure Portal. More Info about WebApp setting please refer to document.
If it is not resolved with above ways, please have a try keep writing out to console to keep the WebJob running.
I have a job that I want to run every ten minutes. To schedule it, I use:
public static IScheduler _scheduler { get; private set; }
...
ISchedulerFactory schedFact = new StdSchedulerFactory();
_scheduler = schedFact.GetScheduler();
_scheduler.Start();
string cron = "0 0/10 * 1/1 * ? *";
JobKey jobkey = new JobKey("Radar", "F");
IJobDetail job = JobBuilder.Create<RadarJob>()
.WithIdentity(jobkey)
.Build();
CronScheduleBuilder csb = CronScheduleBuilder.CronSchedule(new CronExpression(cron)).InTimeZone(TimeZoneInfo.Local);
ICronTrigger trigger = (ICronTrigger)TriggerBuilder.Create()
.WithIdentity("Radar-Trigger", "G")
.WithSchedule(csb)
.Build();
try
{
DateTimeOffset ft = _scheduler.ScheduleJob(job, trigger);
Response.Write("Job Scheduled");
}
catch (ObjectAlreadyExistsException)
{
Response.Write("Job Already Exists!");
}
It seems to work at first, the job runs fine every ten minutes. However, after an hour or so, it stops running. I log successes and errors, and I have no errors. What is causing my job to stop by itself?
I am running IIS 7, .NET Framework 4.0, Using a Shared Hosting Plan from GoDaddy.
Your job is running inside of the IIS AppPool. The pool is probably recycling, which will kill the quartz task, and IIS will not automatically restart it (as it DOES restart web requests which are in process when the pool recycles).
(I'm assuming that you are running the above code in Application_Start() inside of your Global.asax file.)
We had this situation and decided to use quartz as a standalone service which would not be affected by pool recycles, though I'm not sure if this would be a viable option for you under a shared hosting plan.
You indicate that you are running on IIS 7. If in fact this is IIS 7.5, there may be a better solution outlined in Auto-Start application / global.asax / wcf service when IIS7 starts automatically, which would be to configure the app pool to automatically restart.
This is late for answering but I had this kind off error in my application. I solved it by IIS config that I found it in Scott Gu weblog : http://weblogs.asp.net/scottgu/auto-start-asp-net-applications-vs-2010-and-net-4-0-series
I have a SharePoint 2013 installation on a Window 8 machine.
I am trying to create a web application and it is taking forever. The creation process never stops. I checked in application event logs and found this error:
*Machine 'SHAREPOINT2013C (SharePoint - 43000(_LM_W3SVC_1458308317_ROOT))' failed ping validation and has been unavailable since '1/22/2013 3:56:48 AM'.*
Searched the web but could not find anything that works for me.
Can anyone suggest a way to resolve the issue? Thanks a lot in advance.
Below are my findings:
In order to recognize routing targets IIS has to be able to process SPPING HTTP method
To test run this code in Powershell:
$url = "http://your-Routing-Target-Server-Name"
$myReq = [System.Net.HttpWebRequest]::Create($url)
$myReq.Method = "SPPING";
$response = $myReq.GetResponse();
$response.StatusCode
If you get the following error message:
Exception calling "GetResponse" with "0" argument(s): "The remote server returned an error: (405) Method Not Allowed."
that means that web front end is not set up to process SPPING HTTP method
To resolve the issue run the following commands on each routing target server:
Import-Module WebAdministration
add-WebConfiguration /system.webserver/handlers "IIS:\" -value #{
name = "SPPINGVerbHandler"
verb = "SPPING"
path = "*"
modules = "ProtocolSupportModule"
requireAccess = "None"
}
This will add a handler for SPPING verb to IIS configuration.
Run the test script again to make sure this works.
So this has to do with the Request Management Service that runs on the WFE servers on SharePoint 2013. The Request Management Service is of no value since you only have one server. If you disable this service on your single server farm these messages will go away and your Web Application creation performance will greatly increase.
Mark Ringo
I recently faced this issue, I created new Web Application and it was showing a popup of "It shouldn't take long", then after some time it showed a Connection failure page. I browsed to the virtual directory folder for the new web application and found that the folder was totally empty.
Then what I did to solve this problem:
1. Open IIS
2. Go to Applicatin Pools
3. Select Central Admin application pool and right click and select "Advance Settings".
4. There was a property named "Shutdown Time Limit", it was set to "90" by default. I changed it to 400 and clicked OK.
It restarted the applicaition pool automatically. Then again I created new web application from central admin and it worked for me.
I've found that these events correlate to when the specified application pools are recycled (mine are at a specific time in the morning). It's unfortunate that they're logged in the event viewer and can't really clean it up.