Docker Community Forums

Share and learn in the Docker community.

Properties.Settings Issue with running app in windows container on windows


(Snowfire21) #1

hi.
I’m working on converting a windows service to run in a docker container.
this is a windows service that can also be run as a console app
one issue I can’t seem to find a way around is with a Properties.Settings file.
I keep running into this error:
> Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) System.Runtime.InteropServices.COMException (0x8000FFFF): Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

   at System.Security.Policy.PEFileEvidenceFactory.GetLocationEvidence(SafePEFileHandle peFile, SecurityZone& zone, StringHandleOnStack retUrl)
   at System.Security.Policy.PEFileEvidenceFactory.GenerateLocationEvidence()
   at System.Security.Policy.PEFileEvidenceFactory.GenerateEvidence(Type evidenceType)
   at System.Security.Policy.AssemblyEvidenceFactory.GenerateEvidence(Type evidenceType)
   at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)
   at System.Security.Policy.Evidence.GetHostEvidence(Type type, Boolean markDelayEvaluatedEvidenceUsed)
   at System.Security.Policy.AppDomainEvidenceFactory.GenerateEvidence(Type evidenceType)
   at System.Security.Policy.Evidence.GetHostEvidenceNoLock(Type type)
   at System.Security.Policy.Evidence.RawEvidenceEnumerator.MoveNext()
   at System.Security.Policy.Evidence.EvidenceEnumerator.MoveNext()
   at System.Configuration.ClientConfigPaths.GetEvidenceInfo(AppDomain appDomain, String exePath, String& typeName)
   at System.Configuration.ClientConfigPaths.GetTypeAndHashSuffix(AppDomain appDomain, String exePath)
   at System.Configuration.ClientConfigPaths..ctor(String exePath, Boolean includeUserConfig)
   at System.Configuration.ClientConfigPaths.GetPaths(String exePath, Boolean includeUserConfig)
   at System.Configuration.Internal.ConfigurationManagerInternal.System.Configuration.Internal.IConfigurationManagerInternal.get_ExeProductName()
   at System.Configuration.ApplicationSettingsBase.get_Initializer()
   at System.Configuration.ApplicationSettingsBase.CreateSetting(PropertyInfo propInfo)
   at System.Configuration.ApplicationSettingsBase.EnsureInitialized()
   at System.Configuration.ApplicationSettingsBase.get_Properties()
   at System.Configuration.SettingsBase.GetPropertyValueByName(String propertyName)
   at System.Configuration.SettingsBase.get_Item(String propertyName)
   at System.Configuration.ApplicationSettingsBase.GetPropertyValue(String propertyName)
   at System.Configuration.ApplicationSettingsBase.get_Item(String propertyName)
   at .Properties.Settings.get_UploaderService()

Docker file:

FROM microsoft/aspnet:4.7.2-windowsservercore-1803
SHELL [“powershell”, “-Command”, “$ErrorActionPreference = ‘Stop’; $ProgressPreference = ‘SilentlyContinue’;”]
RUN powershell -NoProfile -Command New-Item -ItemType directory -Path C:\logs
RUN powershell -NoProfile -Command New-Item -ItemType directory -Path C:\MyService

WORKDIR /MyService
COPY ./bin/Release/ /MyService
EntryPoint ./MyService.exe “CONSOLE”

I’ve verified that the service runs correctly locall, and where it is installed on a regular server.
As far as I have been able to tell, the error may be due to it trying to access a location for a User config, and can’t.
does anyone have any ideas on how to fix this? (other than re-writing the service to not use Properties.Settings?
I’m also exploring actually installing the service in the container, and running it that way.