Register-ServiceFabricApplicationType on a secure cluster always times out - azure

When this command is executed while connected to a secure cluster:
Register-ServiceFabricApplicationType -ApplicationPathInImageStore 'MyType' -TimeoutSec 600 -Debug -Verbose
...it throws a timeout exception. I can run Copy-ServiceFabricApplicationPackage without problems, so it's clearly possible to connect to the cluster.
Registering an app type shouldn't really be a heavy operation, I therefore suspect that there is some underlying problem.
Stack trace:
VERBOSE: System.TimeoutException: Operation timed out. ---> System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x80071BFF
at System.Fabric.Interop.NativeClient.IFabricApplicationManagementClient6.EndProvisionApplicationType(IFabricAsyncOperationContext context)
at System.Fabric.Interop.Utility.<>c__DisplayClassa.<WrapNativeAsyncInvoke>b__9(IFabricAsyncOperationContext context)
at System.Fabric.Interop.AsyncCallOutAdapter2`1.Finish(IFabricAsyncOperationContext context, Boolean expectedCompletedSynchronously)
--- End of inner exception stack trace ---
Register-ServiceFabricApplicationType : Operation timed out.
At line:1 char:1
+ Register-ServiceFabricApplicationType -ApplicationPathInImageStore 'M ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationTimeout: (Microsoft.Servi...usterConnection:ClusterConnection) [Register-ServiceFabricApplicationType], TimeoutException
+ FullyQualifiedErrorId : RegisterApplicationTypeErrorId,Microsoft.ServiceFabric.Powershell.RegisterApplicationType
Any help greatly appreciated!

If this is a cluster that is hosted by Azure, these settings will be reverted to default values the next time cluster code or configuration upgrade is performed. Please change them by setting the value in the Service Fabric resource via Azure Resource Explorer or PowerShell. This will ensure that these settings are preserved.
"fabricSettings": [
{
"name": "EseStore",
"parameters": [
{
"name": "MaxCursors",
"value": "32768"
}
]
}
],
On the local development cluster you can modify the default cluster manifest XML files located in C:\Program Files\Microsoft SDKs\Service Fabric\ClusterSetup\ with following section and then recreate the cluster.
<Section Name="EseStore">
<Parameter Name="MaxCursors" Value="32768" />
</Section>

Here's what worked for us in a very similar situation:
Please apply the following mitigation steps (one node at a time) on all nodes:
Go to data root of cluster, by default it is “D:\SvcFab\” or C:\ProgramData\Microsoft\SF if you didn’t specify datapath attribute in deployment. Look for folder by name . Inside that folder you will see file Fabric.Package.current.xml. create a backup.
Open the Fabric.Package.current.xml file and look for Fabric.Config version:
Go to config folder for that version and look for Settings.xml file.
Take a backup of Settings.xml file and open the Settings.xml file.
Look for section named “EseStore”.
<Section Name="EseStore">
</Section>
If section is present, add this parameter to section (prefer to type these text in the Settings.xml file than copy-pasting as copy-pasting sometimes appends extra invalid characters at the end).
<Section Name="EseStore">
<Parameter Name="MaxCursors" Value="32768" />
</Section>
If the section with name “EseStore” is not present, add the section name with parameter as and save the file.
Kill FileStoreService.exe on the node.
Wait for the FileStoreService.exe to come back up and then proceed to next node.
After you are done applying mitigation to all nodes and cluster is back up healthy, please retry deploying the package. Please make sure for testing in testing machine first before use on production.

Related

Failed to delete a file in Azure File Share, Error: The specified resource is read-only and cannot be modified at this time

While trying to delete a file in the Azure Storage File Share. I continuously get following error:
Failed to delete file
'cs-firstName-lastname-domain-com-10033fff99999999/mslearn-my-app-folder-word-and-word-wd/.git/objects/pack/pack-someguid.idx'.
Error: The specified resource is read-only and cannot be modified at
this time
Tried to check if there are any current open handles but I see none.
https://learn.microsoft.com/en-us/rest/api/storageservices/list-handles
<?xml version="1.0" encoding="utf-8"?>
<EnumerationResults>
<Entries />
<NextMarker />
</EnumerationResults>
Also, I tried to connect to this Azure file share from Windows by running powershell cmdlet New-PSDrive, but there too and using Remove-Item, getting below error
Remove-Item : Cannot remove item
Z:\mslearn-my-app-folder-word-and-word-wd/.git/objects/pack/pack-someguid.idx: **You
do not have sufficient access rights to perform this operation**.
Any help, about how to change the property from read-only/ how can I delete/ or anything which I am missing.
Thanks,
As mentioned in the link shared by #BhargaviAnnadevara-MSFT, https://social.msdn.microsoft.com/Forums/en-US/6fde433a-aef0-49e9-8568-2aaf5a9b673a/unable-to-delete-a-file-from-azure-file-storage?forum=windowsazuredata The read-only attribute can be removed only once mounted, I did following.
Mounted the File Share using the script provided in the Azure portal
Once mounted, doing a ls command will show the file attributes
In powershell or CMD change the file attribute. I found it hard to do it via powershell so instead used ATTRIB cmd. attrib pack-someguid.idx -R
Update : Easier Solution
https://learn.microsoft.com/en-us/azure/storage/files/storage-how-to-use-files-windows#mount-the-azure-file-share-with-file-explorer

IIS Manager crashes when adding a URLRewrite rule

I am trying to add a URLRewrite blank rule to one of our servers, but when I select it and click OK to add it, IIS Manager closes abruptly.
I checked in the Event Log Viewer and there was an IISM crash with this message:
IISMANAGER_CRASH
IIS Manager terminated unexpectedly.
Exception:System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Web.Management.Server.WebManagementServiceException: Filename: \\?\C:\Windows\system32\inetsrv\config\applicationHost.config
Error: The configuration section 'webFarms' cannot be read because it is missing a section declaration
---> System.Runtime.InteropServices.COMException: Filename: \\?\C:\Windows\system32\inetsrv\config\applicationHost.config
Error: The configuration section 'webFarms' cannot be read because it is missing a section declaration
it looks like your config file is missing webfarms, section should be put directly under configuration node as the declaration in configSections.
Please double check if the section is configured at the correct place.

Use custom, composite resource with Azure DSC extension

I have a VM template that deploys a DSC extension. It's been working fine but my configuration is growing so I've refactored it to use a composite resource and republished it to blob storage with Publish-AzureRmVMDscConfiguration.
I verified that the .ps1.zip file in blob storage contains my custom module and that the module is listed under dscmetadata.json. However, when I deploy, the DSC extension fails. The logs under C:\WindowsAzure\Logs\Plugins\Microsoft.Powershell.DSC\2.17.0.0 reveal the reason:
C:\Packages\Plugins\Microsoft.Powershell.DSC\2.17.0.0\bin..\DSCWork\AppServerDev.ps1.0\AppserverDev.ps1
PSDesiredStateConfiguration\node : The module 'xCustomResource' could
not be loaded. For more information, run 'Import-Module
xCustomResource'.
At C:\Packages\Plugins\Microsoft.Powershell.DSC\2.17.0.0\DSCWork\AppServerDev.ps1.0\AppserverDev.ps1:9 char:3
node "localhost"
~~~~
CategoryInfo : ObjectNotFound: (xCustomResource\xCustomResource:String)
[PSDesiredStateConfiguration\node], ParentContainsErrorRecordException
FullyQualifiedErrorId : CouldNotAutoLoadModule,PSDesiredStateConfiguration\node
Here are the relevant bits of my configuration file:
configuration AppServerDev
{
param($environment)
Import-DscResource -ModuleName 'PSDesiredStateConfiguration'
Import-DscResource -ModuleName 'SaaSModule'
node "localhost"
{
LocalConfigurationManager
{
RebootNodeIfNeeded = $true
ConfigurationMode = "ApplyAndAutoCorrect"
ConfigurationModeFrequencyMins = 1440
}
xDCTPlatformVM VM {
OctopusParametersFile = $environment
ChocolateyPackages = #(
'googlechrome',
'notepadplusplus',
'7zip',
'microsoftwse',
'octopusdeploy.tentacle',
'sqlserver-cmdlineutils'
)
}
}
}
Running Get-Module -ListAvailable reveals that DankModule is found and I can, from powershell, run Import-Module DankModule and it works as expected. I assume the confusion is coming from it trying to import xCustomResource rather than DankModule but my .ps1 file under C:\Packages\Plugins\Microsoft.Powershell.DSC\2.17.0.0\DSCWork says
Import-Module "DankModule"
and not
Import-Module "xCustomType"
Why is it trying to import xCustomType rather than DankModule? How do I make it find DankModule which is available and contains xCustomType?
UPDATE: Get-Module -ListAvailable shows DankModule is installed but Get-DSCResource -Module DankModule doesn't return anything.
I'm not sure but I think this is a rookie mistake on my part because I have no experience building powershell modules. I was using this page as well as this one to construct my module and I'd gotten a valid module file by using New-ModuleManifest, I had the correct file structure mentioned in both of them e.g.
C:\Program Files\WindowsPowerShell\Modules\
DankModule
DankModule.psd1
DankModule.psm1
DSCResources
xCustomResource
xCustomResource.psd1
RootModule = ‘xCustomResource.schema.psm1'
xCustomResource.schema.psm1
Configuration, no Node block
but I didn't realize I had some tweaking left. I needed to correct the RootModule property in DankModule.psd1 to look like this:
RootModule = 'C:\Program Files\WindowsPowerShell\Modules\DankModule\DankModule.psm1'
And also needed to add to my blank DankModule.psm1 a line referencing my xCustomResource.schema.psm1 equivalent:
. .\DSCResources\xCustomResource\xCustomResource.schema.psm1
That is the only line in my module-level .psm1 file and everything is now working. I also, at one point, removed all the \0s from both my .psd1 files but now I'm not sure if that was strictly necessary.

Cruisecontrol.net with UCM Clearcase - How to?

I am trying to configure Cruisecontrol.net for UCM Clearcase for the first time. Following is the sourceControl tag in the ccnet.config file:
<sourcecontrol type="clearCase">
<branch>123_India_Release</branch>
<autoGetSource>true</autoGetSource>
<viewName>admin_123_CRUISE</viewName>
<viewPath>$(ViewDirectory)</viewPath>
<useLabel>false</useLabel>
<useBaseline>false</useBaseline>
<executable>cleartool.exe</executable>
</sourcecontrol>
I constantly receive the following error:
ThoughtWorks.CruiseControl.Core.CruiseControlException: Source control
operation failed: cleartool: Error: Not an object in a vob: "PATH TO
THE VIEW"
When I run cleartool from an arbitrary directory with the following parameters:
cleartool.exe lshist -r -nco -branch "123_India_Release" -since
05-Dec-2012.14:38:18 -fmt
I get the same error. But if I change the working directory to $(ViewDirectory) before running cleartool, it runs fine.
How should I make Cruisecontrol.net run cleartool.exe from the $(ViewDirectory)?
I have already tried adding <workingDirectory>$(ViewDirectory)</workingDirectory> tag before <executable>cleartool.exe</executable> but it did not work.
Any help would be appreciated.
EDIT 1:
As a workaround I have done the following:
<exec>
<executable>cleartool.exe</executable>
<baseDirectory>d:\Workspace\123_India_Release\VOB</baseDirectory>
<buildArgs>update -force</buildArgs>
<buildTimeoutSeconds>6000</buildTimeoutSeconds>
</exec>
I have added this to the tasks tag. I have configured an hourly trigger which does the following:
1) Update snapshot view
2) Build the VS 2010 solutions mentioned in the tasks tag.
The limitations are:
1) The trigger is hourly. I want it to be a commit based trigger.
2) This is a workaround
EDIT 2:
Further experimentation revealed that the ccnet.exe works fine. It does all that is needed. The issue is caused by the service ccservice.
I have stopped ccservice for now and started ccnet.exe. I plan to leave it running.
The View directory isn't enough: you must specify a vob.
See for instance:
"clearfsimport: Error: Not an object in a vob: "\"." (as an illustratio of that error message)
this thread (or this one): "You have to specify explicitly the VOB(s) to check for modification set"
The path should looks like:
<viewPath>Drive:\path\to\view\vobname</viewPath>
If your $(ViewDirectory) already references Drive:\path\to\view, then you could use:
<viewPath>$(ViewDirectory)\vobname</viewPath>

Create Nuget Pacakge with configuration of cloud config(ServiceDefinition.csdef) file

I would like to build Nuget package for my add-on which will be used by end user to install as startup task and after that they will upload their applications on window azure platform.
Let's take one simple web application and one cloud project now using Nuget end user will added add-on package it will add 2 files(exe & config) in web application project & add startup task to ServiceDefinition.csdef of cloud project as per shown in figure
How can i created this type of Nuget Pacakge?
Thanks in advance.
Update:
I have tried according with NICK's answer however i am getting problem with 2 webrole in cloud project according to shown in below fig.
and error i am getting as per below
Also i have one question that If i am installing that Nuget package with command line then how i can consider all webrole projects to add exe and config file in solution??
Nuget packages work based on a convention:
http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package#From_a_convention_based_working_directory
As far as the exe and config you can do the following:
In your package directory make the following directories
mkdir lib (for the exe)
mkdir content (for the config)
All you have to do for the exe is drop the file in the lib directory and modify you .nuspec file just under the metadata node. There should be a "files" node (if not you can add one). Add something like this inside the files node:
<file src="content\my.exe" target="content\my.exe" />
The config is a little different. Just add a file named myname.config.transform to the content directory and add an entry into the .nuspec file:
A couple of things to note:
If the config file does not exist in your app it will add one for you.
You only have to add the nodes you want transformed if there is a file that already exists
The transform file will do a complete match on your node so if the following existed in
your config file:
<add key="test" value="myval"/>
And in your transform you had:
<add key="test" value="myval2"/>
The resulting file would look like:
<add key="test" value="myval"/>
<add key="test" value="myval2"/>
As far as adding the startup task, that's been a little more tricky for me (there might be a much better way). I use powershell in the install.ps1 (just like the files above but you create a "tools" directory for it):
param($installPath, $toolsPath, $package, $project)
#Modify the service config - adding a new Startup task
$svcConfigFile = $DTE.Solution.Projects|Select-Object -Expand ProjectItems|Where-Object{$_.Name -eq 'ServiceDefinition.csdef'}
$ServiceDefinitionConfig = $svcConfigFile.Properties.Item("FullPath").Value
[xml] $xml = gc $ServiceDefinitionConfig
#Create startup and task nodes
# So that you dont get the blank ns in your node
$startupNode = $xml.CreateElement('Startup','http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition')
$taskNode = $xml.CreateElement('Task','http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition')
$taskNode.SetAttribute('commandLine','my.exe')
$taskNode.SetAttribute('executionContext','elevated')
$taskNode.SetAttribute('taskType','simple')
$startupNode.AppendChild($taskNode)
#Check to see if the startup node exists
$modified = $xml.ServiceDefinition.WebRole.StartUp
if($modified -eq $null){
$modified = $xml.ServiceDefinition.WebRole
$modified.PrependChild($startupNode)
}
else{
$nodeExists = $false
foreach ($i in $xml.ServiceDefinition.WebRole.Startup.Task){
if ($i.commandLine -eq 'my.exe'){
$nodeExists = $true
}
}
if($taskNode -eq $null -and !$nodeExists){
$modified.AppendChild($taskNode)
}
}
$xml.Save($ServiceDefinitionConfig);
I hope this helps out.
--Nick

Resources