I am trying to add the following code to my web.config file when installing a DotNetNuke module.
All the Sample files I have seen references providers and existing components on DNN. https://www.dnnsoftware.com/wiki/manifest-config-component
I was wondering I can use <component type="Config"> to add new settings to the web.config file.
https://www.dnnsoftware.com/docs/developers/extensions/dnn-manifest-schema.html
This is the code I would want to add just before the closing </system.webServer> tag
<security>
<requestFiltering>
<!--The default size is 30000000 bytes (28.6 MB). MaxValue is 4294967295 bytes (4 GB)-->
<!-- 100 MB in bytes -->
<requestLimits maxAllowedContentLength="104857600" />
</requestFiltering>
</security>
You can, but please do be advised that there are other settings that control content upload lengths, so it might not be the only thing you need to change.
Also, please do be aware that there are security implications of increasing this value if this is something that is being commercially distributed.
Yes, you'll see some details at https://www.dnnsoftware.com/wiki/manifest-xml-merge
Related
For my Project at work i want to install a provisioning Package, that contains a xml configuration for Kiosk Mode (Assigned Access).
I used the exact code from the xml reference page and inserted my Apps, as an account i used a local account that i created for testing.
<?xml version="1.0" encoding="utf-8" ?>
<AssignedAccessConfiguration
xmlns="http://schemas.microsoft.com/AssignedAccess/2017/config"
xmlns:rs5="http://schemas.microsoft.com/AssignedAccess/201810/config"
>
<Profiles>
<Profile Id="{786df454-09d0-492f-9ef0-c07731d1606f}">
<AllAppsList>
<AllowedApps>
<App DesktopAppPath="C:\Program Files\Google\Chrome\Application\chrome.exe"/>
</AllowedApps>
</AllAppsList>
<StartLayout>
<![CDATA[<LayoutModificationTemplate xmlns:defaultlayout="http://schemas.microsoft.com/Start/2014/FullDefaultLayout" xmlns:start="http://schemas.microsoft.com/Start/2014/StartLayout" Version="1" xmlns="http://schemas.microsoft.com/Start/2014/LayoutModification">
<LayoutOptions StartTileGroupCellWidth="6" />
<DefaultLayoutOverride>
<StartLayoutCollection>
<defaultlayout:StartLayout GroupCellWidth="6">
<start:Group Name="Group1">
<start:Tile Size="4x4" Column="0" Row="0" DesktopAppPath="C:\Program Files\Google\Chrome\Application\chrome.exe" />
</start:Group>
</defaultlayout:StartLayout>
</StartLayoutCollection>
</DefaultLayoutOverride>
</LayoutModificationTemplate>
]]>
</StartLayout>
<Taskbar ShowTaskbar="true"/>
<Taskbar/>
</Profile>
</Profiles>
<Configs>
<Config>
<Account>.\Kiosk-test</Account>
<DefaultProfile Id="{786df454-09d0-492f-9ef0-c07731d1606f}"/>
</Config>
</Configs>
</AssignedAccessConfiguration>
When i try to install it, it either wont install at all with Error code 0x8007000b on one computer or on my private computer the installation will fail.
The Settings say that i has to Lock the user interface and make changes to the device.
then the EventLogs say that it failed due to follwing error: "Error during verification because the document does not contain exactly one root node. (0xC00CE223)" (translated with deepl, so might be a bit different in reality)
I could not find a matching solution on the internet.
I also tried using the configuration Wizard for single app Kiosk, and there the same error occured.
Does anyone of you know a solution to that or can tell me what the problem is at all?
I tried to change every part of the code, so that every aspect (App, User, e.g.) is tested seperately.
I moved my computer out the group policies, so that there are no GPOs that vreate an error.
The error messages didn't change at all
Thanks and best Regards!
I'm using solr4.5.1 in work.
The trouble is that a lot of getConnection occurred, when I execute data-import(full-import). So I thought if HikariCP could be used in data-import, but I haven't found similar problem.
Is it possible? If so please advice.
Solr 4.5.1 with Tomcat
data-config.xml
<dataSource driver="oracle.jdbc.driver.OracleDriver"
name="jdbc"
url="jdbc:oracle:thin:#address/mydb"
user="user" password="pass"/>
Heavily borrowed from David H Nebinger's post: Tomcat and HikariCP.
Install HikariCP
To make use of JNDI, you need to declare the JNDI datasource with all its' settings, password and cache options within the JNDI declaration. This has nothing to do with Solr at this point. This is a Tomcat mechanism. How you do this is described in this tutorial that also makes use of HikariCP.
First is to download the .zip or .tar.gz file from http://brettwooldridge.github.io/HikariCP/. This is actually a source release that you'll need to build yourself.
Second option is to download the built jar from a source like Maven Central, https://mvnrepository.com/artifact/com.zaxxer/HikariCP
Once you have the jar, copy to the Tomcat lib/ext directory. Note that Hikari CP does have a dependency on SLF4J, so you'll need to put that jar into lib/ext too.
Do not forget to place your datasource's JDBC driver in the lib/ext folder.
Configure the JNDI datasource
Location of your JNDI datasource <Resource /> definitions depends upon the scope for the connections. You can define them globally by specifying them in Tomcat's conf/server.xml and conf/context.xml, or you can scope them to individual applications by defining them in conf/Catalina/localhost/WebAppContext.xml (where WebAppContext is the web application context for the app, basically the directory name from Tomcat's webapps directory).
Create the file conf/Catalina/localhost/ROOT.xml if it doesn't already exist. Use the table from https://github.com/brettwooldridge/HikariCP#popular-datasource-class-names to find your data source class name, we'll need it when we define the element.
<Resource name="jdbc/SolrPool" auth="Container"
factory="com.zaxxer.hikari.HikariJNDIFactory"
type="javax.sql.DataSource"
minimumIdle="5"
maximumPoolSize="10"
connectionTimeout="300000"
dataSourceClassName="oracle.jdbc.pool.OracleDataSource"
dataSource.url="jdbc:oracle:thin:#address/mydb"
dataSource.implicitCachingEnabled="true"
dataSource.user="user"
dataSource.password="pass" />
Make use of the JNDI datasource in Solr
After you have followed this tutorial, you will need to use the declared JNDI datasource, this would be like described in the Solr Wiki:
<dataSource
jndiName="java:jdbc/SolrPool"
type="JdbcDataSource"
user="" password=""/> <!-- leave out user/password here -->
I have an app.config file in our WPF project that is transformed using the following build target in the .csproj
<!-- MSbuild Task for transforming app.config based on the configuration settings -->
<UsingTask TaskName="TransformXml"
AssemblyFile="$(SolutionDir)\packages\MSBuild.Microsoft.VisualStudio.Web.targets.12.0.4\tools\VSToolsPath\Web\Microsoft.Web.Publishing.Tasks.dll" />
<Target Name="AfterBuild">
<!-- Transform the app.config into the correct config file associated to the current build settings -->
<TransformXml Source="App.config" Transform="App.$(Configuration).config" Destination="$(OutputPath)\App.config" />
<!-- Bit of .Net to get all folders and subfolders that we want to delete post-build -->
<ItemGroup>
<FoldersToClean Include="$([System.IO.Directory]::GetDirectories("$(OutputPath)"))" />
</ItemGroup>
<!-- Delete all of our localization folders and .pdb symbols. We only delete PDB files for Release builds. Debug builds we will leave them. -->
<RemoveDir Directories="#(FoldersToClean)" />
<Exec Command="del $(OutputPath)*.pdb" Condition=" '$(Configuration)'=='Release' " />
</Target>
This correctly generates an App.config after the compilation, with my transformed QA or Production configuration files created. The issue I ran into however is that the following code uses AppName.exe.config.
string encryptedString = ConfigurationManager.AppSettings["SqlConnection"];
After doing a bit of reading, I understand why it's doing that. The App.config file ultimately becomes the AppName.exe.config for use during runtime. That's fine; my transformation happens to late though. When the compilation is completed, the AppName.exe.config file contains my base App.config file information, and none of the transformed settings. I assume that is due to the transform happening as a post-build step, where it transforms the App.config after the original App.config file was used to generate AppName.exe.config.
It looks like there isn't any thing preventing me from changing
<TransformXml Source="App.config"
Transform="App.$(Configuration).config"
Destination="$(OutputPath)\App.config" />
so that it replaces the AppName.exe.config file post-build.
<TransformXml Source="App.config"
Transform="App.$(Configuration).config"
Destination="$(OutputPath)\AppName.exe.config" />
Is there anything wrong with this? There isn't much in the way of help when using app.config and transforms for desktop applications. Everything I've read online is for transforming things into a web-config file. I assume this is safe and more or less is the same thing. However I wanted to make sure I'm not missing any glaring side-effects or issues i'll encounter by replacing the original AppName.exe.config with the transformed App.config.
Install this https://github.com/acottais/msbuild.xdt NuGet package and you will be able to create transforms like a web.config.
There are several other Nuget packages that will transform the app.config just like the web.config.
I used this one the other day and it worked great.
I have a WPF app that creates some text files in its own install directory. However, even after the UAC prompt, windows vista and windows 7 users often times still get "file access failed" type errors. The solution is to find the executable in windows explorer and open up the compatibility tab under the file properties and check "run as administrator". This is obviously a terrible user experience but I'm not sure how to ensure the app can secure itself these permissions without that step being taken. I am not trying to bypass the UAC prompts.
In general, .Net wants you to put application generated files either into the user's home directory or the shared user folder. Have a look at this answer: When using a Settings.settings file in .NET, where is the config actually stored?
It talks about .Net config files but you can put other files there.
You can force your app to start with admin rights (UAC will show it's dialog box anyway) by embedding custom manifest (project properties -> build -> Manifest).
Manifest example (requestedExecutionLevel part is importaint):
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly manifestVersion="1.0"
xmlns="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv1="urn:schemas-microsoft-com:asm.v1"
xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<assemblyIdentity version="1.0.0.0" name="yourappname.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of all Windows versions that this application is designed to work with. Windows will automatically select the most compatible environment.-->
<!-- If your application is designed to work with Windows 7, uncomment the following supportedOS node-->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>-->
</application>
</compatibility>
</asmv1:assembly>
I"m working on a dot net nuke site for a client, they are wanting to upload files of about 60mbs. I have changed the web.config file to allow files up to 65 mbs in size just for wiggle room.
httpRuntime useFullyQualifiedRedirectUrl="true" maxRequestLength="66560" requestLengthDiskThreshold="66560" executionTimeout="1080000" />
this is the code in the web.config file. I have personally tried mp3 files ranging from 40 mbs - 60 mbs in size to no luck. The module will only upload files of 28mbs or less. We are using the Live Content module if this helps.
The connection is getting reset. its not even getting to the 18 minute timeout i have given it, even if it is only set to 3 minute timeout i get same error. Also when uploading the file it will get to 86% then restart when it gets to 86% again is when it gets the error.
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2000000000" />
</requestFiltering>
</security>
actually fixed it, the dot net nuke is set to upload files up to 8mbs, the iis is set to only allow files up to 30mbs. adding this code to the web.config file will allow files larger than 200mbs to be uploaded. using the code i provided in my question will modify the dnn's upload but this will modify the iis.
The wiki on DotNetNuke.com gives a complete and thorough explanation of this.
You may also have to increase the value of AspMaxRequestEntityAllowed, see: http://www.banmanpro.com/support2/File_Upload_limits.asp