Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

does not find Azure connection string when in library of Web API app #37

Closed
jackfoxy opened this issue Jan 18, 2014 · 6 comments
Closed

Comments

@jackfoxy
Copy link

Using Web API app derived from Dan Mohl's F# MVC5 template.

When SqlCommand compiled in main application (using App.config for connection string for local execution), it works locally and it works on an Azure website.

When SqlCommand compiled in a library project in the Solution (using App.config in the library project for connection string for local execution), it works locally, but on Azure it throws the following exception:

An exception of type 'System.Exception' occurred in FSharp.Data.Experimental.SqlCommandProvider.dll but was not handled in user code

Additional information: Connection string [connection string name] is not found.

@dmitry-a-morozov
Copy link
Member

I think you need to use web.config both compile and run time.
SqlCommand<..., ConfigFile = "web.config">

@dmitry-a-morozov
Copy link
Member

@jackfoxy Did you resolve the issue?

@jackfoxy
Copy link
Author

Yep

@dmitry-a-morozov
Copy link
Member

@jackfoxy @vasily-kirichenko I just pushed an update to nuget. I've heard complains that it's bit inconvenient to specify connection string on each SqlCommand instantiation. Now "SqlCommandProvider" is default for ConnectionStringName parameter. If combined with either App.Config or Web.Config file in design type it's enough to specify something like:

type MyQuery= SqlCommand<"SELECT * FROM MyTable">

Of course it expects following in config file

Enjoy.

@jackfoxy
Copy link
Author

I assume the old format still works...multiple connection strings is a possible scenario.

@dmitry-a-morozov
Copy link
Member

Correct. Should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants