开发者

How do I provide a connection string to a WCF Service from a WPF Browser Application?

I am learning WPF and WCF. I created a WPF User Control Library and buit a control. Then I created a WPF Application which displays the control in a window. Then I created a WCF Service Library to provide data for the control. At first, I received this error:

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

Following the instructions here: [StackOverflow], I put the connection string into the WPF Application's app.config, and that fixed the problem.

Now, I've created a WPF Browser Application which displays the control in a browser. Once again, I get the same error. This time, however, I can't put the connection string into the WPF Browser Application's app.config file because, apparently, there is no app.config file for WPF Browser Applications. How, then, do I specify the connection string r开发者_运维技巧equired by the WCF Service?

-TC


After some more research, I've discovered that WPF Browser Applications do use app.config files after all. I added an app.config file to my project and put the connection string into it, and now the application works as expected.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜