1

I developed a SharePoint Custom Timer Job which reaches SQL Server by Entity Framework. So normally EF uses SharePoint application's web.config AppSettings to get the ConnectionString it needed. But, in this case, where Custom Timer Job reaches SQL Server via EF, it gives me

The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.

It is obvious that it can't read ConnectionString value from configuration.

QUESTION:

Do you guys know where is this SharePoint Customer Timer Job's configuration file is? SharePoint Administration application web.config? machine.config? Feature.xml of Feature?

If it doesn't read this info from a config file, what should I do to access ConnectionString of EF? Use properties of Custom Timer Job to persist ConnectionString information?

ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239
Mlh
  • 147
  • 3
  • 16

2 Answers2

1

Timer job is not hosted by web application. It is running in separate process - owstimer.exe. Locate the file on your server and simply create owstimer.exe.config file (if it doesn't exists) and place necessary configuration to that file.

Ladislav Mrnka
  • 360,892
  • 59
  • 660
  • 670
  • I gave the necessary configuration for EF in the file that you mentioned at Fadrian Sudaman's post's comment, but still same issue continues. Do you have an advice? – Mlh May 08 '11 at 21:58
  • Why do you have `connectionString` under `runtime` element? That should be directly under `configuration` element. – Ladislav Mrnka May 09 '11 at 07:30
1

SP job timer is executed by the SP timer job window service. The exe is Owstimer.exe located in the bin folder. You can add to or created Owstimer.exe.config so that your custom job can read from it.

Fadrian Sudaman
  • 6,405
  • 21
  • 29
  • So I changed it as, ` ` but still same error. – Mlh May 08 '11 at 21:56
  • And does it work? You will need to restart the service for the config to take effect – Fadrian Sudaman May 08 '11 at 21:57
  • Oh I noticed you use integrated security. When job is started by the timer it will take whatever the process owner for the service (Owstimer) which is usually network service or local service. This acc prob can't auth to your SQL server. I suggest create and acc and use it in your conn string or set the service to launch as a specific user – Fadrian Sudaman May 08 '11 at 22:04
  • restarted the Timer Service and IIS. Deployed Custom Timer Job solution again and still same error exists. – Mlh May 08 '11 at 22:04
  • The SharePoint 2010 Timer service LogOnAs user is a domain user and it has necessary SQL server permissions on both machine and DB. Sorry to bother you for this small prob, but you know it is pain in the a** for me right now. Also, it is 1am in local time:) – Mlh May 08 '11 at 22:07
  • Sorry Melih I don't have anyore thoughts on what may cause your problem. Try trace logging your code and also te exceptions and see if the problem is still wig EF and not other permission error. If this box is not your regular dev machine try connecting to the SQL instance manually to ensure all the firewall and port bypassing are set correctly. Good luck – Fadrian Sudaman May 08 '11 at 23:05