This is interesting, I have attached my web.config file and the
exception I have been logging. I created a library which provide data
access to a database and a control system. The library is written in
C#. I created a small .exe file to test that the library builds
propertly from configuration and that it communicates properly. This
work great in the System.Windows.Forms. However, when I use the
library in a web enviroment things don't go so well. I copy the
unique instruction in the app.config file the the web.config file.
Bellow is the exception generated, essentially the system crashed when
it tries to load Systetem.Configuration.SingleTagSectionHandler which
I used in the web.config & app.config file.
Now WHY does the config file work in a desktop app enviroment and when
in a web enviroment I get problems! Any suggestions on how to fix the
problem would be much appreciated.
I am using the 1.1 version on the Framework.
The following is the exception which I log :
Exception: System.Configuration.ConfigurationException
Message: Exception creating section handler.
(c:\inetpub\wwwroot\VBTestSorter\web.config line 7)
Source: System.Web
at System.Web.Configuration.HttpConfigurationRecord.G etFactory(String
configKey)
at System.Web.Configuration.HttpConfigurationRecord.E valuate(String
configKey, SectionRecord section)
at System.Web.Configuration.HttpConfigurationRecord.G etConfig(String
configKey, Boolean cacheResult)
at System.Web.Configuration.HttpConfigurationRecord.G etConfig(String
configKey, Boolean cacheResult)
at System.Web.HttpContext.GetConfig(String name)
at System.Web.Configuration.HttpConfigurationSystemBa se.System.Configuration.IConfigurationSystem.GetCo nfig(String
configKey)
at System.Configuration.ConfigurationSettings.GetConf ig(String
sectionName)
at Hinz.WeyerChem.Sorter.DataAccessLayer.Database.tab les.LoadLotDAL.Initialize()
Nested Exception
Exception: System.TypeLoadException
Message: Could not load type
System.Configuration.SingleTagSectionHandler from assembly System.Web,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
Source: mscorlib
at System.Type.GetType(String typeName, Boolean throwOnError)
at System.Web.Configuration.HttpConfigurationRecord.G etFactory(String
configKey)
This is an example of my web.config file :
<configSections>
<sectionGroup name="Sorter">
<section name="connectionString"
type="System.Configuration.SingleTagSectionHandler " />
<section name="sp_prefix"
type="System.Configuration.SingleTagSectionHandler " />
<section name="sp_sufix"
type="System.Configuration.SingleTagSectionHandler " />
</sectionGroup>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHa ndler,log4net" />
</configSections>
<Sorter>
<connectionString dsn="server=SQL-01;uid=sa;pwd=password;database=SorterUpgrade"
/>
<sp_prefix insert="sp_Insert_" delete="sp_Remove_"
update="sp_Update_" select="sp_Select_" />
<sp_sufix destination="Destination" gradebutton="GradeButton"
gradename="GradeName" button="Button" lot="Lot"
nomThck="NominalThickness" nomWid="NominalWidth"
recalc="RecalcLength" run="Run"
wndThck="ThicknessWindow" wndWid="WidthWindow" master="MasterSort"
sort="Sort"
mastersort_sort="MasterSort_Sort" status="Status" state="State"
species="Species"
catThk="ThicknessCategory" catWid="WidthCategory"
pctWid="WidthCategroyPCT"
catLen="LengthCategory" pctLen="LengthCategoryPCT"
catGrd="GradeCategory"
pctGrd="GradeCategoryPCT"/>
</soreter
<log4net>
......
</log4net>