2010-03-18 3 views
0

Существует тот же вопрос, указанный в разделе The key 'UserID' does not exist in the appSettings configuration section, но, к сожалению, ни один из ответов не работал в моем случае. Все работало нормально, я проверил все, и когда я снова открыл решение, он начал рушиться на выше. Я не могу найти никакого намека на то, что я делаю неправильно. Любые идеи?Сбой в работе Windows с «ключ не существует в разделе конфигурации appSettings»

<configuration> 
    <configSections> 
     <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > 
      <section name="SMS.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77b444444e089" requirePermission="false" /> 
     </sectionGroup> 
    </configSections> 
    <appSettings> 
     <add key="URI" value="http://123.123.123.57:8080/smsxml/collector"/> 
     <add key="Provider" value="220"/> 
     <add key="LongCode" value="+3"/> 
     <add key="DBServer" value="APPS"/> 
     <add key="DBUsername" value="sms"/> 
     <add key="DBPassword" value="sms1"/> 
     <add key="Database" value="SMSService"/> 
     <add key="Pooling" value="True"/> 
     <add key="PoolMax" value="50"/> 
     <add key="PoolInit" value="5"/> 
     <add key="DBPollInterval" value="5"/>  
    </appSettings> 

System.InvalidOperationException was unhandled 
    Message="The key 'LongCode' does not exist in the appSettings configuration section." 
    Source="System" 
    StackTrace: 
     at System.Configuration.AppSettingsReader.GetValue(String key, Type type) 
     at SMS.smsOxy..ctor() in C:\Documents and Settings\K\My Documents\Visual Studio 2008\Projects\SMSComponent-Oxy\SMSComponent\smsOxy.vb:line 327 
     at SMS.smsOxy.Main() in C:\Documents and Settings\K\My Documents\Visual Studio 2008\Projects\SMSComponent-Oxy\SMSComponent\smsOxy.vb:line 57 
     at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) 
     at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args) 
     at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel) 
     at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly() 
     at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData) 
     at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext) 
     at System.Activator.CreateInstance(ActivationContext activationContext) 
     at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone() 
     at System.Threading.ThreadHelper.ThreadStart_Context(Object state) 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
     at System.Threading.ThreadHelper.ThreadStart() 
    InnerException: 

" at System.Configuration.AppSettingsReader.GetValue(String key, Type type) at SMS.smsOxy..ctor() in C:\Documents and Settings\K\My Documents\Visual Studio 2008\Projects\SMSComponent-Oxy\SMSComponent\smsOxy.vb:line 327 at SMS.smsOxy.Main() in C:\Documents and Settings\K\My Documents\Visual Studio 2008\Projects\SMSComponent-Oxy\SMSComponent\smsOxy.vb:line 57 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args) at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel) at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly() at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData) at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext) at System.Activator.CreateInstance(ActivationContext activationContext) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()" 
+0

Пожалуйста, сообщите точное сообщение об ошибке, включая stacktrace, если оно есть. – Bobby

+0

Как выглядит эта линия? smsOxygen8.vb: строка 327 –

+0

Me.Originator = CType (configurationAppSettings.GetValue («LongCode», GetType (System.String)), String) – Fet

ответ

1

Как начать стартовой? Убедитесь, что файл appname.exe.config в папке, в которой работает служба, имеет одинаковые параметры приложения.

+0

Вы правы Андрей - спасибо – Fet

0

Попробуйте скопировать <appSettings></appSettings> из app.config в файл bin/Debug/appname.exe.config, как, когда один строит/компилирует, VS.NET копии и переименовывает app.config (БИН/Debug /appname.exe.config) в папку bin.