Windows Service The underlying provider failed on Open Problem
I Developed Windows Service with EF4.0.
There is a some standart code in my code that is run in console application.
private void ServiceTimer_Tick(object sender, System.Timers.ElapsedEventArgs e)
{
this.tim开发者_如何学Pythoner.Stop();
try
{
using (PHEntities pe = new PHEntities ())
{
var result = (from c in pe.tblCustomer
from j in c.tblJPConfig
select new { c.ID, c.ExpireTime, j.printed}
);
foreach (var item in result)
{
.....
}
}
this.timer.Start();
}
catch (Exception ex)
{
eventLog1.WriteEntry(ex.Message, EventLogEntryType.Error);
}
After this code run, Event viewer write "The underlying provider failed on Open Problem" Error.
Please Help.
That means that it is having trouble connecting to your database. Check your connection string and passwords. Check that the database accepts incoming connections. Try connecting manually (using SQL Server Management Studio if it is an MS SQL Server)
精彩评论