2sxc template error when under Host file system - dotnetnuke

Im using the Tiles app from 2sxc.org. When the Razor template location is selected as Host File System it throws the following error
Web.Config
under /Portals/0/2sxc folder where razor template works
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor">
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web.webPages.razor>
<pages pageBaseType="ToSic.SexyContent.Razor.SexyContentWebPage">
<namespaces>
<!--<add namespace="Microsoft.Web.Helpers" />
<add namespace="WebMatrix.Data" />-->
</namespaces>
</pages>
</system.web.webPages.razor>
</configuration>
Web.Config Portal
*under /Portals/ folder *
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor">
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc"/>
<pages pageBaseType="DotNetNuke.Web.Mvc.Framework.DnnWebViewPage">
<namespaces>
<add namespace="System.Linq"/>
<add namespace="System.Web.Mvc"/>
<add namespace="System.Web.Routing"/>
<add namespace="DotNetNuke.Web.Mvc.Helpers"/>
</namespaces>
</pages>
</system.web.webPages.razor>
</configuration>
Web.Config Host
There is no web.config file under /Portals/_default/2sxc
Platform and 2sxc version:
DNN Evoq Content 08.04.02 (5) (both local and Azure based installation exhibit same errors)
2sxc 8.5.4

Related

WPF+c#+SQLite: Error in assemblyn reference or what?

I'm working in a desktop application with SQLite as its database.
i'm working with EF6 -no Entity F Core- in Visual Studio CE.
This is my app.config from my console application
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SQLite" type="System.Data.SQLite.SQLiteProviderServices, System.Data.SQLite.Linq"/>
</providers>
</entityFramework>
<connectionStrings>
<add name="DataContext" connectionString="Data Source=.\MainDB.sqlite;Version=3;" providerName="System.Data.SQLite" />
</connectionStrings>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
<remove invariant="System.Data.SQLite" />
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>
</system.data>
</configuration>
And when I'm trying to test this code:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SQLite" type="System.Data.SQLite.SQLiteProviderServices, System.Data.SQLite.Linq"/>
</providers>
</entityFramework>
<connectionStrings>
<add name="DataContext" connectionString="Data Source=.\MainDB.sqlite;Version=3;" providerName="System.Data.SQLite" />
</connectionStrings>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SQLite.EF6" />
<add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
<remove invariant="System.Data.SQLite" />
<add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
</DbProviderFactories>
</system.data>
</configuration>
But when I build the project this meesage appears:
The Entity Framework provider type 'System.Data.SQLite' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SQLite' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
¿How to fix it?
Thanks for any support

Application with no connection string - Where is the DB hidden?

So, I have created a console application, added the entity framework nuget package, created a dbcontext and enabled migrations for my project.
However, I don't see the database anywhere. The database exists since I can query it when I run the application but since I haven't entered a connection string I don't see it anywhere in my SQL Management Studio.
My question is, where do Visual Studio "hide" this database?
Btw, I'm using EF6 Code First.
EDIT: Here is my app.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
Add this to constructor of the context to see the default connection string used.
public class MyContext : DbContext
{
public MyContext()
{
Console.WriteLine(this.Database.Connection.ConnectionString);
}
}
Usually it creates the database in v11.0 or mssqllocaldb(in you app.config it is mssqllocaldb) instance of sqllocaldb.
The database file can be located at Users folder(Windows 8.1):
C:\Users\{UserName}\ApplicationName.ContextName.mdf

How to specify Entity Framework Code First connection string in external Enterprise Library config file

I am creating a WPF application, having classical architecture: UI layer, business logic layer and infrastructure layer. I decided to split configuration in two files: app.config file, containing common app configuration, and dll.config, containing connection string to use in DbContext for domain model storage. The second .config file should be sticked to business logic DLL, while first file sticked to corresponding UI executable (there will be one more UI with it's own configuration).
app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="enterpriseLibrary.ConfigurationSource" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ConfigurationSourceSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
</configSections>
<enterpriseLibrary.ConfigurationSource selectedSource="Winter DAL Configuration">
<sources>
<add name="Winter DAL Configuration" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
filePath="dll.config" />
</sources>
</enterpriseLibrary.ConfigurationSource>
</configuration>
dll.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
</configSections>
<dataConfiguration defaultDatabase="WinterContext" />
<connectionStrings>
<add name="WinterContext" connectionString="Data Source=Winter.sdf"
providerName="System.Data.SqlServerCe.4.0" />
</connectionStrings>
</configuration>
Now, when I'm starting the app, DbContext throws an exception saying it cannot find connection string with specified name. If I move connection string from dll.config to app.config - all working fine.
Maybe I must explicitly load configuration somehow? Or?.. What do I do wrong?
Thx in advance!
Based on the config files supplied, Entity Framework went looking in app.config of root in start project and didnt find the EF content. Especially the Connection string.
When you first used UF it would have created such entries, perhaps in the model project.
IM using EF5.0 so careful with cut and paste on Entity Section .
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
</entityFramework>
<connectionStrings>
<add name="CONTEXT_NAME_HERE"
providerName="System.Data.SqlClient"
connectionString="Data Source=YOURDB_SERVER;Initial Catalog=YOUR_DBNAME;Integrated Security=True;MultipleActiveResultSets=True;App=EntityFramework" />
</connectionStrings>
</configuration>
I hope I understood your question, you want to structure your app.configs as a hierarchy, which is valid, in web applications that is very common, the easiest way to let .net help you with the merging is specifiying the regions of app.config in all those configurations that need to be bounded, and in the inner configurations you can override the values until you have the last one, for example:
ROOT APPCONFIG
<configuration>
<commonCollection>
<add key="first" value="1" />
<add key="second" value="2" />
<add key="third" value="3" />
</commonCollection>
</configuration>
INNER APPCONFIG
<configuration>
<commonCollection>
<remove key="first" />
<add key="first" value="10" />
</commonCollection>
</configuration>
Results:
ROOT APPCONFIG
first : 1
second: 2
third: 3
INNER APPCONFIG
first: 10
second: 2
third: 3
EDIT
for your EF context, to set the connection string in the constructor :
public MyContextDB() :base("name=DefaultConnection")
{
//other initializers
}
hope it helps,

edit key->value in .exe.config in SmartClient

I'll start here: I know nothing about SmartClient, .Net, DotNetNuke, etc etc. This is a "see if alison can help" project for a client's app/ site developed 6 years ago by a company that won't help. I'm just a front-end developer- I've googled all I can. If I don't understand the advice given here, I'm passing on assisting the client. Just thought I would give it a whirl. Here goes:
We simply need to change a key -> value in the configuration of their desktop app which connects to a web service (ASEPublisher). I have FTP and SQL Server access, but that's it.
The desktop app folder contains the following files:
DataPublisher.exe
DataPublisher.exe.config
DataPublisher.pdb
OleDBDataAccess.dll
OleDbDataAccess.pdb
Their website contains a folder called "smartclient" that contains the same files.
I just need to change all of the urls in the code below and have the application update to use the new urls. Obviously just changing this file on the desktop and restarting the app didn't do it. So, here I am. I hope this isn't too vague. If you need more info, I can try to provide it.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="DataPublisher.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<appSettings>
<add key="DefaultFilePath" value="I:\Staff\fakefolder\database\SA Data.mdb" />
<add key="DefaultASEFilePath" value="I:\Staff\fakefolder\database\SA Data.mdb" />
<add key="CNN" value="Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=" />
<add key="WebSvcUrl" value="http://www.fakedomain.org/admin/ClassPublisher.asmx" />
<add key="ASEWebSvcUrl" value="http://www.fakedomain.org/admin/ASEWebService.asmx" />
</appSettings>
<applicationSettings>
<DataPublisher.Properties.Settings>
<setting name="DataPublisher_ClassPublisherWS_ClassPublisher"
serializeAs="String">
<value>http://www.fakedomain.org/admin/ClassPublisher.asmx</value>
</setting>
<setting name="DataPublisher_ASEPublisherWS_ASEWebService" serializeAs="String">
<value>http://www.fakedomain.org/admin/ASEWebService.asmx</value>
</setting>
</DataPublisher.Properties.Settings>
</applicationSettings>
</configuration>

Entity Framework connectionString with remote server (URL)

This is a WPF app which references an Entity Framework class library. In the App.config of the class library project I have this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
</configuration>
All very standard. What I want to do is to add a connection string which will enable me to connect to remote server via a URL to the database. Is this going to be possible?
I've tried something like this:
<connectionStrings>
<add name="LanguageEntities" connectionString="metadata=res://*/LanguageModel.csdl|res://*/LanguageModel.ssdl|res://*/LanguageModel.msl;provider=System.Data.SqlClient;provider connection string="data source=http://www.myweb.net:667;User ID=Remote;Password=cleverstring;initial catalog=LanguageModel.LanguageEntities;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
But my app seems to default to the local connection without giving me an error message.
Any suggestions gratefully received.
Many thanks!

Resources