I need to access the database from a web service, for which I have several projects within the solution .. the web service, by itself initiates a timer, which executes an action every X seconds. This action is inside a class library (Business) which in turn accesses a DAL layer (in another class Library) that accesses the BD. I usually use this scheme, to access the data in the database, exceptionally in this particular case, my user interface is a windows service. This service has an App.config file, where you install the conextionString corresponding to the BD. I already verified in another project (winform) that the conectionString is working (it brings me data from the BD) For the installation of the service, generate an installer in the same solution. All this compiles without probes. and the service is installed correctly. moreover, when I start it, it tells me that the timer is running by executing every N seconds the routine that accesses the DB with the method described above. My problem is that at the time of access, I see (after a while) a message that tells me that you can not access the BD. This is the message
System.Data.SqlClient.SqlException (0x80131904): Error related to the network or specific to the instance while establishing a connection to the SQL Server. The server or this one was not found It was not accessible. Check that the name of the instance is correct and that SQL Server is configured to support connections remote. (provider: SQL Network Interfaces, error: 26 - Error when search the specified server or instance)
in the app.config I have the following definition for the conextionstrig
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
<connectionStrings>
<!--<add name="ModelAccuro" connectionString="data source=ZERO-DEV3;initial catalog=CertusAccuro_dev;Persist Security Info=false; pwd=52SP%uEvCj@F0;User ID=accuro; integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />-->
<!--<add name="ModelAccuro" connectionString="data source=ZERO-DEV3;initial catalog=CertusAccuro_dev;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />-->
<add name="ModelAccuro" connectionString="data source=DESKTOP-6U3TOS0;initial catalog=CertusAccuro_dev;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" />
<!--<add name="ModelAccuro" connectionString="data source=DESKTOP-R8F381P\SQLEXPRESS;initial catalog=CertusAccuro_dev;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient"/>-->
</connectionStrings>
... resto del app.config
Help pls .. I've been with this mess for a while and I can not solve it. Thanks