Need Help Configuring Site / Upgrading N2

Topics: Developer Forum, Project Management Forum, User Forum
Nov 1, 2008 at 3:01 AM
I'm Windows-dumb and N2-dumber. My current host can't keep my site online consistently and I'm being forced to move the website to a new host. In short, I've already moved the website to the new host but can't get it to work properly (I've made the obvious changes to the config file with no luck).

So now, I'm looking to outsource the work to someone who knows how to not only get the site online, but to upgrade N2 to the current version. 

Please PM with rates if you're interested. For someone who knows N2 and Windows, this is pretty easy money. The current error reports:


Server Error in '/' Application.

Runtime Error

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. 

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

<!-- Web.Config Configuration File --><configuration>    <system.web>        <customErrors mode="Off"/>    </system.web></configuration>

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.

<!-- Web.Config Configuration File --><configuration>    <system.web>        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>    </system.web></configuration>



I did the needful in the configuration file to turn custom error reporting off, but I'm still getting the generic runtime page. Any help is appreciated.





Nov 1, 2008 at 7:48 AM
Did you make sure you did change the CustomErrors tag to <customErrors mode="Off" /> in the web.config file and re-uploaded it to your new host?
It should make the error visible after a reload of the page (try Ctrl + F5 on IE).

With the error it is a lot easier to help...
Nov 1, 2008 at 1:32 PM
Edited Nov 1, 2008 at 1:44 PM
Thanks for the reply. I've moved over to the new webhost and it seems that the database went from 2000 to 2005 with the move. I know that this changes the connection string. Also, I changed the <customErrors mode="Off" /> in the config file located in the root directory, but it still reports the generic page.  Is there another config file I should be changing? My entire configuration is below. 

<?xml version="1.0"?><configuration>
<configSections>
<section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor" />
<section name="WinFxHttpCompressionModule"
type="WinFxProgrammer.WinFxHttpCompressionSection, WinFxHttpCompression, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</configSections>
<connectionStrings>

<clear/>
<add name="LocalSqlServer" connectionString="Server=sql.oldhost.com;Database=dbCMS;user=username;password=mypass" />
</connectionStrings>
<WinFxHttpCompressionModule enableTrace="true"compressDefaultHandler="true"compressTraceHandler="true"compressWebResourceHandler="true"preferredAlgorithm="GZip"maximumCompressionLevel="Ten"forceAcceptEncodingHeader="false"compressionFactory="WinFxProgrammer.WinFxStandardCompressionFactory,WinFxHttpCompression">
<excludedPaths>
<add value="/images/" />
<add value="/edit/" />
<add value="/img/" />
</excludedPaths>
<excludedMimeTypes>
<add value="application/octet-stream" />
<add value="application/pdf" />
</excludedMimeTypes>
</WinFxHttpCompressionModule>
<castle>
<properties>
<rootItemID>1</rootItemID>
<nhSettings>
<dictionary>
<entry key="hibernate.connection.provider">NHibernate.Connection.DriverConnectionProvider</entry>
<entry key="hibernate.connection.connection_string_name">LocalSqlServer</entry>
<entry key="hibernate.cache.use_second_level_cache">true</entry>

<entry key="hibernate.cache.use_query_cache">true</entry>
<entry key="hibernate.cache.provider_class">NHibernate.Caches.SysCache.SysCacheProvider,NHibernate.Caches.SysCache</entry>
<entry key="hibernate.connection.driver_class">NHibernate.Driver.SqlClientDriver</entry>
<entry key="hibernate.dialect">NHibernate.Dialect.MsSql2005Dialect</entry>
</dictionary>
</nhSettings>
</properties>
<include uri="assembly://N2/Engine/n2.configuration.xml"/><!-- Configuration goes here -->
<components>
<component id="n2.typeFinder">
<parameters>
<EnsureBinFolderAssembliesLoaded>false</EnsureBinFolderAssembliesLoaded>
<AssemblyNames>
<list>
<item>N2.Trashcan</item>
<item>N2.Edit.Export</item>
<item>N2.Edit.LinkTracker</item>
<item>MBI.CMS.NTwo.Items</item>
</list>
</AssemblyNames>
</parameters>
</component>
</components>
</castle>
<system.web>
<customErrors mode="Off" />
<pages validateRequest="false">
<controls>
<add tagPrefix="n2" assembly="N2" namespace="N2.Web.UI.WebControls"/>
</controls>
</pages>
<siteMap defaultProvider="PublicSiteMap">

<providers>
<add name="PublicSiteMap" type="N2.Web.PublicSiteMapProvider, N2" startPageIsRoot="true"/>
<add name="EditSiteMap" type="N2.Edit.Web.EditSiteMapProvider, N2.Edit" startPageIsRoot="false" />
<add name="FileSiteMap" type="N2.Edit.Web.FileSiteMapProvider, N2.Edit" startPageIsRoot="false" />
</providers>
</siteMap>
<httpModules>
<add name="HttpCompressionModule" type="WinFxProgrammer.WinFxHttpCompression, WinFxHttpCompression"/>
<add name="Trashcan" type="N2.Trashcan.TrashModule,N2.Trashcan"/>
<add name="InitializerModule" type="N2.Web.InitializerModule,N2"/>
</httpModules>
<httpHandlers>
<add path="WinFxCompress.axd" type="WinFxProgrammer.WinFxHttpCompressionTraceHandler, WinFxHttpCompression" verb="GET" validate="false"/>

</httpHandlers>
<compilation debug="true">
<expressionBuilders>
<add expressionPrefix="CurrentItem" type="N2.Web.Compilation.CurrentItemExpressionBuilder, N2"/>
<add expressionPrefix="CurrentPage" type="N2.Web.Compilation.CurrentPageExpressionBuilder, N2"/>
<add expressionPrefix="Code" type="N2.Web.Compilation.CodeExpressionBuilder, N2"/>
</expressionBuilders>
</compilation>
<authentication mode="Forms">
<forms loginUrl="edit/login.aspx" protection="All" timeout="30000" path="/">
<credentials passwordFormat="Clear">
<user name="admin" password="password" />
</credentials>
</forms>
</authentication>
</system.web>
<appSettings>

<add key="SMTP.Server" value="[CENSORED]"/>
<add key="SMTP.UN" value="[CENSORED]"/>
<add key="SMTP.PW" value="[CENSORED]"/>

<add key="ResetData" value="false"/>
</appSettings>
</configuration>

Nov 1, 2008 at 2:00 PM

Web.config is the only file you need to configure to get the site up and running.

Can you log in to N2 backend or is the site not responding at all?
Have you verified that you can access the dbCMS database with the user credentials specified in the connection string?

After setting CustomErrors to Off, you should get a more detailed error description...

Nov 2, 2008 at 3:23 AM
I copied and pasted one of my N2 files directly into a .aspx file and now receive the following. This has nothing to do with the web.config file. I'm super lost on this.

Server Error in '/' Application.

Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: Assembly system.xml.dll security permission grant set is incompatible between appdomains.

Source Error: 

[No relevant source lines]

Source File: machine.config    Line: 274 


Version Information: Microsoft .NET Framework Version:1.1.4322.2407; ASP.NET Version:1.1.4322.2407


Nov 3, 2008 at 12:23 PM
It looks like your website is configured to run .NET version 1.1.
Try change it to use version 2.0+
Nov 3, 2008 at 12:32 PM
This site is running on a shared hosting server. Is it possible to do this in the configuration file?
Nov 3, 2008 at 1:22 PM
Depends on the hosting provider and which option's it has provided you with...try it!
Nov 3, 2008 at 1:50 PM

Which hosting provider do you use?
If you send a link to the provider, we can see which versions they support (assuming they have an English version of their website).

Nov 3, 2008 at 1:57 PM
I was able to upgrade the plan to 2.0 which seems to have worked on getting to the real configuration problems. It seems though
 I can't even run a simple script without the Required permissions cannot be acquired error. I uploaded a simple time script and get the same thing.
I believe there is something amiss in my configuration file. Could someone please tell me what the web.config file should contain for a site
running ASP version 2+ and MSSQL 2005? It seems there needs to be a file containing the password, as I didn't see a place to enter the username/password
in the <add name="N2CMS" connectionString="Server=(local);Database=N2_Templates;Integrated Security=SSPI"/> connection string. Also, my connection consists 
of an IP address with a port number (192.171.38.2:2920 for example)

Thanks in advance. 

Required permissions cannot be acquired.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Security.Policy.PolicyException: Required permissions cannot be acquired.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[PolicyException: Required permissions cannot be acquired.]   System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission) +2770052   System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission) +57[FileLoadException: Could not load file or assembly 'System.Data.SQLite, Version=1.0.52.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]   System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0   System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +54   System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +211   System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +141   System.Reflection.Assembly.Load(String assemblyString) +25   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +32[ConfigurationErrorsException: Could not load file or assembly 'System.Data.SQLite, Version=1.0.52.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]   System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +596   System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +211   System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +46   System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +177   System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +185   System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +230   System.Web.Compilation.BuildManager.CompileGlobalAsax() +49   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +462[HttpException (0x80004005): Could not load file or assembly 'System.Data.SQLite, Version=1.0.52.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]   System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +57   System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +612   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +644[HttpException (0x80004005): Could not load file or assembly 'System.Data.SQLite, Version=1.0.52.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +3465427   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +69   System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +279



Nov 3, 2008 at 6:10 PM

Web.config settings depends on which version of N2 you are using. You can download N2 here... remember to download the same version you are using. In the file you download, there is an example of the web.config file.

If you want to specify username and password in the connectionstring, you can use something like this:

<add name="N2CMS" connectionString="Data Source=192.171.38.2:2920;Initial Catalog=myN2Database;User Id=myUsername;Password=myPassword;" />

Do you have a reference to ”System.Data.SQLite” in the web.config?
It looks like the IIS is trying to load the assembly... and fails doing it.
If you use MSSQL 2005, you do not need a reference to System.Data.SQLite.

Coordinator
Nov 3, 2008 at 8:02 PM
Hi, there's some hints in the wiki. In a medium trust hosting provider you need to remove /bin/System.SQLite.dll.

In your web.config you should remove your <castle> section and replace it with a <n2> section. See the example. You will need to update the connection string name in <n2><database .