ArcGis 10.1 - .NET Windows Service - c#

Background:
.NET Framework 2.0, C#
ESRI ArcGis 10.1
64-bit Windows Server 2008 R2.
We have a thirdparty program (System A for simplicity) using ESRI-components running a custom Model-system for Maps.
System A also uses it own licensing system.
We are pulling data from System A to the web for users to view.
The system as it follows:
Web <-> WebService (using .NET-Remoting 2.0) <-> WindowsService.exe <-> DataFetcherStub.dll <-> DataFetcher.dll <-> System A
Problem:
Running this on ArcGIS 9.3 up to ArcGIS 10.0 have been no problem and earlier version of System A.
The providers of System A currently upgraded this to ArcGIS 10.1, using .NET-interop from 10.0.
We did that also, but now it will not work using the .NET-Remoting -> WindowsService any more.
Running an EXE using the DataFetcherStub everything is ok.
Running the windows service it crashes within the System A.
Faulting application name: windows_service.exe, version: 1.0.4802.40962, time stamp: 0x51293874
Faulting module name: AfCore_libFNP.dll_unloaded, version: 0.0.0.0, time stamp: 0x4f920360
Exception code: 0xc0000005
Fault offset: 0x619fe9b0
Faulting process id: 0x14c0
Faulting application start time: 0x01ce120f632c1f0e
Faulting application path: D:\path\windows_service.exe
Faulting module path: AfCore_libFNP.dll
Report Id: a41b42dc-7e02-11e2-8e56-00155d0a11a9
Have anyone come up with this error when having licensing with ArcGIS and running through a windows service?
There is a thread on ESRI-forums, but it wont leave me any clues how to solve this?
http://forums.arcgis.com/threads/74546-Product-Licensing-in-Scheduled-Batch
Approaching the vendor is not an option as it took them nearly a year to fix the last problem we discovered. Pointing the finger at us for 9 months before they finally got the proof that it was their bug, and i am pretty sure they will fight this also. It is quicker if we can do a work-around.
I have tried doing this from the windows-service.
1) System.Threading.ThreadPool.QueueUserWorkItem(o => FireAndForgetProcess()); NO LUCK
2) Process.Start("FireAndForgetMe.exe") NO LUCK
Anyone can give another approach to get external exe to "release itself" from the windows service and act as if it started by it own?

The Esri development team gave me a fix without having to run using an admin account.
The issue here is that the FLEXnet Licensing Service (which Esri now uses at 10.1, but was not used in 10.0) doesn’t have the proper execution permissions set to it such that the “Network Service” account can start it.
Esri working on a patch, but in the meantime, there is a manual workaround:
Ensure that you are logged in as a user with administration privileges on the machine.
From the windows Start menu, select run and enter ‘cmd’. Right-click on “cmd.exe” and select “Run as Administrator.”
In the command prompt, run the following command:
sc sdshow "FLEXnet Licensing Service"
This will print out the DACL permissions that are registered with that service:
D:(D;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;NU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;;CCLCSWRPLOCRRC;;;IU)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)
We need to insert “(A;;CCLCSWRPWPDTLOCRRC;;;WD)” into the permission string, such that it becomes:
D:(D;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;NU)(A;;CCLCSWRPWPDTLOCRRC;;;WD)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;;CCLCSWRPLOCRRC;;;IU)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)
NOTE: The user’s DACL string may vary, and edits to the string should be done carefully.
To register the DACL with the service run the command:
sc sdset "FLEXnet Licensing Service" ${your original DACL string with the new permission string inserted}
For the example above you would enter:
sc sdset "FLEXnet Licensing Service" D:(D;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;NU)(A;;CCLCSWRPWPDTLOCRRC;;;WD)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;;CCLCSWRPLOCRRC;;;IU)S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)
You should see a [SC] SetServiceObjectSecurity SUCCESS. That's it. Network Service should now run without error.

Solution
I changed the account that are running the windows-service to my admin-account, and now it works. Either 10.1 demands more of the windows-account running the service, or they have downgraded the account.
I guess i have to check that in the morning. Problem solved however.
EDIT: It is the rights of the accounts that need to be raised after 10.1.

Related

mso20win32client.dll error when initializing new_RDOSession

I am getting errors in event viewer every time my application runs this line:
Redemption.RDOSession rSession = RedemptionLoader.new_RDOSession();
event viewer error:
faulting application name: (my.exe)
exception code: 0xc0000005
faulting module path: C:\Program Files\Common Files\Microsoft Shared\Office16\mso20win32client.dll
The oddest part is that it proceeds to create the session and makes it to the end of my code if I let it, successfully looking up an email in Outlook. This is in production and has worked for years, but for some months now it has been racking up the same error in Event Viewer. End users don't notice, but IT is seeing thousands of errors now which makes it hard for them to know when other problems might be showing up.
I reproduced this on the first try with:
Windows 10 Home, OS build 19044.1706, Windows Feature Experience Pack 120.2212.4170.0
Outlook: Microsoft® Outlook® for Microsoft 365 MSO (Version 2205 Build 16.0.15225.20172) 64-bit
I added logging in my CS code to make sure this caused the error. The error occurs if set ignoreoutlook to "e", and not if I set it to "d":
Microsoft.Office.Interop.Outlook.Application oApp = (Application)Marshal.GetActiveObject("Outlook.Application");
if (ignoreoutlook.Equals("d")) return;
Redemption.RDOSession rSession = RedemptionLoader.new_RDOSession(); // new Redemption.RDOSession();
if (ignoreoutlook.Equals("e")) return;
As for:
C:\ProgramFiles\Common Files\Microsoft Shared\Office16\mso20win32client.dll
it doesn't exist. There is a dll of that name in both:
C:\Program Files\Microsoft Office\root\vfs\ProgramFilesCommonX86\Microsoft Shared\OFFICE16
C:\Program Files\Microsoft Office\root\vfs\ProgramFilesCommonX64\Microsoft Shared\OFFICE16
If Redemption wants to use that dll, how is it working without it?
Is there a way to configure Redemption to skip that dll and move on to whatever else it must be doing to get it to work after that error?
There are quite a few things going on once the MAPI system (when Redemption loads it and calls MAPIInitialize) initializes common Office runtime, which has a bunch of its own problems, since it loads telemetry and licensing. Some of that functionlity only works when running inside the (virtualized) Office app environment (it patches a few Win API functions etc.)
Check if you see the same problem in MFCMAPI if you log to a profile (to ensure the MAPI system is loaded). If you do, that means the problem is in the MAPI system and you can work with MS support. If not, something is specific to your app.
One thing to keep in mind is that your app must embed a manifest and advertise its support for Windows 10. Otherwise common Office run-time tries to patch wrong Win API functions.

Install Visual Studio 2010 error

I am using Window 7 pro x64. I had istalled VS 2010 pro. After that, I uninstalled it and replaced with VS 2012 ulti. Now, I need the VS 2010 but i can't install it. I try to install both pro and ulti version from .iso file but i get the same error. The installer quit suddenly after a few second and the window log records two error:
-The first:
Faulting application name: setup.exe_Microsoft® Visual Studio® 2010, version: 10.0.30319.1, time stamp: 0x4ba20d29
Faulting module name: ntdll.dll, version: 6.1.7601.17514, time stamp: 0x4ce7ba58
Exception code: 0xc0000006
Fault offset: 0x0003dccf
Faulting process id: 0x1170
Faulting application start time: 0x01cf728abd52e628
Faulting application path: F:\setup\setup.exe
Faulting module path: C:\Windows\SysWOW64\ntdll.dll
Report Id: fb6a8ef5-de7d-11e3-ada9-70f39529732e
-And the second:
Windows cannot access the file F:\setup\sqmapi.dll for one of the following reasons: there is a problem with the network connection, the disk that the
file is stored on, or the storage drivers installed on this computer; or the disk is missing. Windows closed the program Suite Integration Toolkit
Executable because of this error.
Program: Suite Integration Toolkit Executable
File: F:\setup\sqmapi.dll
The error value is listed in the Additional Data section.
User Action
1. Open the file again. This situation might be a temporary problem that corrects itself when the program runs again.
2. If the file still cannot be accessed and
- It is on the network, your network administrator should verify that there is not a problem with the network and that the server can be
contacted.
- It is on a removable disk, for example, a floppy disk or CD-ROM, verify that the disk is fully inserted into the computer.
3. Check and repair the file system by running CHKDSK. To run CHKDSK, click Start, click Run, type CMD, and then click OK. At the command prompt,
type CHKDSK /F, and then press ENTER.
4. If the problem persists, restore the file from a backup copy.
5. Determine whether other files on the same disk can be opened. If not, the disk might be damaged. If it is a hard disk, contact your administrator or
computer hardware vendor for further assistance.
Additional Data
Error value: C0000023
Disk type: 5
I try to uninstall .Net 4.5 and install .Net 4.0 but it not help. I run the system file checker and hard drive checker but no error. Then i download the ntdll.dll and sqmapi.dll to replace these files in my computer but it also not help.
I think the .iso file still good because it still run in my friend computer.
So anyone suggest a solution ?
After i scan my computer with avira and delete some file buildlog in D drive(in my computer, C drive for OS and software, D drive for data), the installer work normally!
But i don't understand why some file buildlog in D drive can make VS can't install?

Windows Phone Emulator Won't Start, NetBT error

Windows Phone Emulator can not start. When I try to start emulator say "Windows Phone Os is Starting". I looked the Computer Management/Event Viewer. When I try to start Windows phone Emulator, in the system log some errors appear.
1st
Log Name: System
Source: NetBT
Date: 12/8/2013 23:08:11
Event ID: 4307
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: birfincankafein
Description: Initialization failed because the transport refused to open initial addresses.
2nd:
Log Name: System
Source: Microsoft-Windows-Hyper-V-VmSwitch
Date: 12/8/2013 23:08:04
Event ID: 27
Task Category: (1019)
Level: Warning
Keywords:
User: SYSTEM
Computer: birfincankafein
Description:
Networking driver in Emulator 8.0.10322 WXGA.metehan loaded but has a different version from the server. Server version 5.0 Client version 4.0 (Virtual machine ID B0F3F3F5-7D6F-4551-848D-230DF063B1DF). The device will work, but this is an unsupported configuration. This means that technical support will not be provided until this problem is resolved. To fix this problem, upgrade the integration services. To upgrade, connect to the virtual machine and select Insert Integration Services Setup Disk from the Action menu.
3th:
Log Name: System
Source: storvsp
Date: 12/8/2013 23:08:01
Event ID: 6
Task Category: None
Level: Warning
Keywords: Classic
User: N/A
Computer: birfincankafein
Description:
A storage device in 'Emulator 8.0.10322 WXGA.metehan' loaded but has a different version from the server. Server version 6.0 Client version 5.1 (Virtual machine ID B0F3F3F5-7D6F-4551-848D-230DF063B1DF). The device will work, but this is an unsupported configuration. This means that technical support will not be provided until this problem is resolved. To fix this problem, upgrade the integration services. To upgrade, connect to the virtual machine and select Insert Integration Services Setup Disk from the Action menu.
Have you tried what it suggests in the error message?
To fix this problem, upgrade the integration services. To upgrade, connect to the virtual machine and select Insert Integration Services Setup Disk from the Action menu.
[edit]
I jumped ahead and tried this, but I don't think it will ultimately help you. I could insert the virtual Integration Services Setup Disk, but could not get it to run. See below...
Instead, I think you'll have to look wider to resolve this problem. First off, make sure you're running a host OS that supports Hyper-V, the virtual machine management component. This is the professional edition of Win7 (for VS2012) or Win8 (VS2013). If you do have a capable host OS, then try re-installing the existing instance of Visual Studio (Control, Programs and Features, right click on VS...). And if that doesn't work, remove Visual Studio, reboot, reinstall. And if that doesn't work, I know not what.
Here's what I tried with Integration Services. Maybe a wiser head can jump in and provide the missing magic...
on a Pro edition of Windows...
Install Hyper-V Manager, if you don't already have it. (Control
Panel, Programs and Features, Turn Windows Features On or Off,
select 'Hyper-V' then check both platform and management tools.).
Reboot.
Open Hyper-V manager(Home screen, start typing 'hyper', Search will
find it.)
Under 'Virtual Machines', highlight one of the Emulator ... virtual
machines. Right click, 'Connect'.
Verify emulator is currently powered off (i.e, not showing WP home
screen in emulator).
In 'Emulator ...' window, 'File' menu, choose 'Settings'.
In 'Settings for Emulator ...' window, highlight IDE controller 1'
in left hand panel.
In right hand panel, highlight 'DVD drive' and click Add.
Now start up the emulator VM. Back in 'Emulator ...' window,
'Action' menu, select 'Power on'. In the main panel, you should
shortly see the WP home screen.
Finally, 'Action' menu, 'Insert Integration Services Setup Disk'.
Hyper-V knows where it is.
And... nothing happens. I see no indication that the VM ran the setup program or did anything. Maybe, if your VM was somehow misconfigured in the first place, this will silently fix your problem. Friendly wizards invited to incant.

Unable to get console input mode - 0x80070006

I am working on bitsadmin for downloading the files in the network.
I created process for running bitsadmin job creation, addjob, resume, etc.
Application works fine with windows 7 but when i run my exe on xp machine bits give exception as
BITSADMIN version 2.0 [ 6.6.2600.2180 ]
BITS administration utility.
(C) Copyright 2000-2004 Microsoft Corp.
Unable to get console input mode - 0x80070006
The handle is invalid.
but on xp machine when i create job using command prompt then it works.
What can be the problem???
I got the solution instead of using process for bitsadmin I used "SharpBITS.Base" to download the file.

an unhandled win32 exception occurred in w3wp.exe

I get the following exception when trying to load an ASP.NET MVC website:
Unhandled exception at 0x07070a91 in w3wp.exe: 0xC0000005: Access
violation reading location 0x00000000.
The Visual Studio Just-In-Time Debugger opens and the only information I can see in the debugger is this:
Call stack location:
msvbvm60.dll!06c00a91()
The website uses some COM objects and everything worked fine until last week. This problem appeared out of the blue.
This is the error log from Windows Event Viewer:
Faulting application name: w3wp.exe, version: 7.5.7601.17514, time stamp: 0x4ce7a5f8
Faulting module name: MSVBVM60.DLL, version: 6.0.98.15, time stamp: 0x4a5bda6c
Exception code: 0xc0000005
Fault offset: 0x00030a91
Faulting process id: 0x1a0
Faulting application start time: 0x01cd31fcb47f66d8
Faulting application path: C:\Windows\SysWOW64\inetsrv\w3wp.exe
Faulting module path: C:\Windows\system32\MSVBVM60.DLL
Report Id: f5db0ae3-9def-11e1-ad79-005056c00008
Do you have any suggestions to help troubleshoot this problem?
Edit: I managed to solve the problem and now everything works. The solution involved tweaking some registry settings that the custom dlls need in order to function properly. So the problem didn't actually appear out of the blue, I just didn't realize some registry values were modified, which caused a com dll to crash.
Open the Advanced settings dialog of the Application pool that is serving the application in IIS Manager, and set: Enable 32-Bit Applications to True
The information you provided above is not enough to provide a root cause however if you can provide more info about the exception you might get exact reason for this failure. You asked for suggestion to troubleshoot this problem so here they are:
You can use either any one of the 3 tools to troubleshoot this issue:
IIS Debug Diagnostics Tool v1.2
Here is more info about how to use this tool:
http://support.microsoft.com/kb/919790
DebugDiag
Use the link below to understand how you can hook your w3wp process (it is user mode proces) with DebugDiag and collect more info about the crash:
http://msdn.microsoft.com/en-us/library/ff420662.aspx
WinDBG
Here is a link which will help you to load W3WP process in WinDBG and use some commands to extract more info about the crash:
http://blog.whitesites.com/Debugging-Faulting-Application-w3wp-exe-Crashes__634424707278896484_blog.htm
Once you have more info about the exception, you can add above and will get prompt help.
Do the Following,
1) Give full rights to Temp & %temp% folders
2) Go to application pool properties & Change " Enable 32 bit application " to true
You may start by capturing a crash dump when this issue happens again,
http://support.microsoft.com/kb/2580960
Use Debug Diag 1.2 to set up a crash rule properly is step 1.
Once you have the dump, you can use WinDbg (part of Debugging Tools for Windows) to analyze it if you are familiar with dump analysis.
If you are not capable of analyzing that, my suggestion is that you open a support case via http://support.microsoft.com and share the dumps with Microsoft support engineers.
In my case, a program called "Web Companion" was installed.
After uninstalling it, the problem was fixed.
My Solution is if you want to build it on 64bit:
Debug ==> Options ==> Search for iis ==> enable using of 64bit Version of IIS Express
This was the fix that worked for me while publishing WebAPI 7.0 to IIS on Windows 10 Enterprise Edition:
Open IIS.
Go to your Application Pool.
Right-click on it -> Advanced Settings...
Under Process Model, change Identify from "ApplicationPoolIndentity" to "LocalSystem".
Restart your IIS.
In my case, It was occurring because there was an infinite loop over the code.

Categories