I need to be able to call methods on a controller class from one of our company's modules from a Windows Application. Apparently the activator cannot read the appropriate string that generates the fully qualified type for the SQLDataProvider from the app.config. The module works fine from within the web portal.
Has anyone here been successful calling into the DotNetNuke controller classes from outside of the DNN web project (from within a windows form application)? Any insight into what you did to make it work would be useful. I am using DNN 4.3.4 and 2.0 Framework. Here is details of the error and a snapshot of my app.config from the Windows Application:
Outer exception: "The type initializer for 'AGS.Modules.CoreServices.DataProvider' threw an exception."
Inner exception: Value cannot be null. Parameter name: type
Stack Trace:
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at DotNetNuke.Framework.Reflection.CreateObject(String TypeName, String CacheKey, Boolean UseCache)
at DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectProviderName, String ObjectNamespace, String ObjectAssemblyName, Boolean UseCache)
at DotNetNuke.Framework.Reflection.CreateObject(String ObjectProviderType, String ObjectNamespace, String ObjectAssemblyName)
at AGS.Modules.CoreServices.DataProvider.CreateProvider()
at AGS.Modules.CoreServices.DataProvider..cctor()
Here is a look at the app.config:
<
configuration>
<!--
register local configuration handlers -->
<
configSections>
<
sectionGroup name="dotnetnuke">
<!--
the requirePermission attribute will cause a syntax warning - please ignore - it is required for Medium Trust support-->
<
section name="data" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke" />
<
section name="caching" requirePermission="false" type="DotNetNuke.Framework.Providers.ProviderConfigurationHandler, DotNetNuke" />
</
sectionGroup>
</
configSections>
<
connectionStrings>
<
add name="SiteSqlServer" connectionString="Server=**;Database=**;uid=**;pwd=**;" providerName="System.Data.SqlClient" />
</
connectionStrings>
<
dotnetnuke>
<
data defaultProvider="SqlDataProvider">
<
providers>
<
clear />
<
add name="SqlDataProvider" type="DotNetNuke.Data.SqlDataProvider, DotNetNuke.SqlDataProvider" connectionStringName="SiteSqlServer" upgradeConnectionString="" providerPath="" objectQualifier="" databaseOwner="dbo" />
</
providers>
</
data>
<
caching defaultProvider="FileBasedCachingProvider">
<
providers>
<
clear />
<
add name="FileBasedCachingProvider" type="DotNetNuke.Services.Cache.FileBasedCachingProvider.FBCachingProvider, DotNetNuke.Caching.FileBasedCachingProvider" providerPath="~\Providers\CachingProviders\FileBasedCachingProvider\" />
<
add name="BroadcastPollingCachingProvider" type="DotNetNuke.Services.Cache.BroadcastPollingCachingProvider.BPCachingProvider, DotNetNuke.Caching.BroadcastPollingCachingProvider" providerPath="~\Providers\CachingProviders\BroadcastPollingCachingProvider\" />
</
providers>
</
caching>
</
dotnetnuke>
</
configuration>