为什么wcfServices为null [英] Why does the wcfServices is null

查看:71
本文介绍了为什么wcfServices为null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我非常喜欢通用WCF服务主机和客户端"一文.

对不起,我几乎不会用英语写东西,所以很遗憾,您可能很难理解我写的东西,
因为我始终无法从Code Project网站下载代码,所以我直接从Browse Code复制了代码以创建项目.现在我有一个问题:在以下所示位置执行过程时出错:

I like the article "Generic WCF Service Host and Client" very much.

I''m sorry I can hardly write in English, so I regret that it is perhaps difficult for you understand what I writing,
because I always can''t download the code from the Code Project website, so I have directly copied the code from Browse Code to create the project. Now I have got a problem: an error when the procedure executes at the position of shown below:

//... ...
foreach (WcfServiceConfigElement item in wcfServices.Services);
//... ...

这属于"Config.cs"和方法InitializeConfig().
看来wcfServices尚未初始化.因此,我直接将XMK配置复制到"App.config"文件中,但是系统提示找不到元素wcfServices,服务…
我考虑了以下声明:

This belongs to "Config.cs" and the method InitializeConfig().
It looks like the wcfServices is not be initialized.So I directly copy the XMK configurations to the "App.config" file, but the system prompt that can not find the architecture information of the elements wcfServices, services…

I considered the statement:

wcfServices = (WcfServiceConfigurationSection)ConfigurationManager.GetSection("wcfServices");


wcfServices应该在此之前初始化,但是它在哪里?
我该怎么做?谁可以给我一些有关此问题的指导?
我花了很多时间写这篇文章,这对我来说很难,我非常希望得到您的指导.


the wcfServices should be initialized before this,but where it is?
How can I do it? who can give me some directions about this problem?
I consume a lot of time to write this, it’s very difficult to me, I greatly hope to get your directions, please.

推荐答案

您的App.config是否包含<configSections>?

Does your App.config include the <configSections>?

...
<configsections>
  <section name="wcfServices" type="WcfServiceCommon.WcfServiceConfigurationSection, WcfServiceCommon" />
</configsections>
...





另外,您是否知道可以通过单击文章顶部的浏览代码"选项卡在CodeProject上浏览可下载项目的源代码?

希望这会有所帮助,
弗雷德里克(Fredrik)





Also, did you know that you can browse the source code of the downloadable projects at the CodeProject by clicking the "Browse Code" tab at the top of the article?

Hope this helps,
Fredrik


这篇关于为什么wcfServices为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆