K
K
Konstantin Oleksyuk2016-03-24 18:13:07
.NET
Konstantin Oleksyuk, 2016-03-24 18:13:07

The first time it looks for user.config, although all the settings are for application, what's wrong?

Good afternoon.
Application when run on client machine (Win2003) requires user.config
- Configuration system failed to initialize
System.Configuration.ConfigurationErrorsException: Error loading configuration file: Could not find part of path 'C:\Documents and Settings\serg\PhoneServer.exe_Url_4d5jpmlnqmy1cb2cpuf3x1r3yge4heag\ 1.0.0.0\user.config". (C:\Documents and Settings\serg\Application Data\......
On the machine on which the application was written (Win2007) I found a similar folder with an empty user.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <configSections>
    </configSections>
</configuration>
,
in the configuration file for the values ​​set the area application.
I put a crutch - I threw daddies with pens, a file (same empty) - it worked, but this is not an option.
Please tell me what am I doing wrong?
My application config file
<?xml version="1.0"?>
<configuration>
<configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c562344e089" >
        <section name="PhoneServer.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c562544e089" requirePermission="false" />       
    </sectionGroup>
</configSections>
<connectionStrings>
    <add name="PhoneServer.Properties.Settings.ConnectString"
        connectionString="Data Source=localhost;Initial Catalog= db_data;User ID=admin;Password=123" />
</connectionStrings>
<startup>
  <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
  <applicationSettings>
        <PhoneServer.Properties.Settings>
              <setting name="CONTACT_TYPE_OUT_ID" serializeAs="String">
                    <value>1</value>
              </setting>           
              <setting name="CONTACT_TYPE_IN_ID" serializeAs="String">
                    <value>42</value>
              </setting>
        </PhoneServer.Properties.Settings>    
    </applicationSettings>

  <system.serviceModel>
    <bindings>
    <netTcpBinding>
        <binding name="tcp_Unsecured">
                <security mode="None"></security>
        </binding>
      </netTcpBinding>
    </bindings>

    <behaviors>
      <serviceBehaviors>
        <behavior name="PhoneServiceBehavior">
          <serviceMetadata httpGetEnabled="false"/>
          <serviceDebug includeExceptionDetailInFaults="true "/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
 
    <services>
        <service name="AsterManagerService.ServerObject" behaviorConfiguration="PhoneServiceBehavior">
        <host>
          <baseAddresses>
            <add baseAddress="net.tcp://localhost:9998/PhoneService"/>
          </baseAddresses>
        </host>
        <endpoint address="" binding="netTcpBinding" contract="AsterManagerService.IServerObject"  bindingConfiguration="tcp_Unsecured"   />
        <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
      </service>
    </services>

  </system.serviceModel>
</configuration>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Oleksyuk, 2016-03-25
@kos25

It's simple, the project properties Application -> Startup Object - was set to Not set , set Program, everything went.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question