今天在练习使用nhibernate来开发时,发现项目启动时会提示C# no source available异常,从而导致整个项目无法正常运行。检查了一下,发现原来是app.config出现的错误导致的:
<configSections>
<section name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
将以上代码中startup和configsections两节位置调换一下即可。
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<configSections>
<section name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"/>
</configSections>
以后编辑这些配置文件时,还是需要注意相关配置项的位置。