Implementing BlogEngine as an application within Umbraco - iis

I have an installation of Umbraco v4.9.0 within which I am trying to get a working install of BlogEngine.NET v2.6.0.5
This is in IIS8 on a Windows 8 machine.
I have so far been able to set up BlogEngine within a sub folder and the application works just fine until I try to open a page with the cshtml extension.
The error i am getting is
This type of page is not served.
Description: The type of page you have requested is not served because
it has been explicitly forbidden. The extension '.cshtml' may be
incorrect. Please review the URL below and make sure that it is
spelled correctly.
Requested URL: /blog/admin/default.cshtml
Both web.configs have entries designed to prevent this error from happening.
Umbraco
<buildProviders>
<add extension=".cshtml"
type="umbraco.MacroEngines.RazorBuildProvider, umbraco.MacroEngines" />
<add extension=".vbhtml"
type="umbraco.MacroEngines.RazorBuildProvider, umbraco.MacroEngines" />
<add extension=".razor"
type="umbraco.MacroEngines.RazorBuildProvider, umbraco.MacroEngines" />
</buildProviders>
BlogEngine
<buildProviders>
<remove extension=".cshtml" />
<add extension=".cshtml"
type="System.Web.WebPages.Razor.RazorBuildProvider, System.Web.WebPages.Razor"/>
</buildProviders>
I have the relevant MVC binaries in the respective bin folders and I've even tried adding request filtering instructions to both web.configs e.g
<requestFiltering>
<fileExtensions>
<add fileExtension=".cshtml" allowed="true" />
</fileExtensions>
</requestFiltering>
Have I missed something obvious?

Is your IIS site running in Classic or Integrated mode? Try switching to Integrated mode and see if that fixes your issue.

Related

Windows authentication with Nodejs and IIS; issue getting username

I'm trying to setup a NodeJS web app with IIS to first use Windows Authentication, if not found then have the ability to use Anonymous Authentication to access the website.
Following this article https://github.com/tjanczuk/iisnode/issues/87, I promoted "the IIS server variables to X-iisnode-* HTTP request headers" as you can see in the config file below.
The problem is this: when Anonymous Authentication is off in IIS, all domain users get authenticated correctly, but Anonymous users can't access the website at all.
When I turn on Anonymous Authentication, all users access anonymously and the variable auth_user always comes back empty.
Is there a way to tell IIS, enforce Windows Authentication first, if not a domain user then use Anonymous Authentication?
I'm running the NodeJS app in a Windows 2012 server, iisnode, IIS 8
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>
<rewrite>
<rules>
<rule name="app">
<match url="^/*" />
<action type="Rewrite" url="app.js" logRewrittenUrl="false" />
</rule>
</rules>
<rewriteMaps>
<rewriteMap name="http://website/">
<add key="http://website/" value="192.168.10.1/" />
</rewriteMap>
</rewriteMaps>
</rewrite>
<iisnode promoteServerVars="AUTH_USER,AUTH_TYPE" />
</system.webServer>
</configuration>
I also tried using node-sspi to get the user's information, which worked when I ran the application on stand-alone mode, it failed when I tried to run it behind IIS... has anybody tried this?

Asp.Net Core tag in web.config causes failure

I have a .NET Core application which works on one machine but not on another.
The problem is that the application fails to load, because the IIS does not recognize the following
<aspNetCore processPath="dotnet" arguments=".\MyApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
The result is that when I click on the IIS authentication configuration, I get an error. If I remove the aspNetCore tag I can view the authentication settings, but then the application doesn't actually start.
Before you start giving advice about not using web.config for .NET Core, remember that it works on my other machine. Also, I need to use Windows Security and ASP.NET Impersonation.
Both machines are running Windows 10 Pro, and I have checked the following
IIS features installed: identical
WAS and W3SVC: both started and running under Local System
Application Pool: both have .Net 4.0 CLR, classic mode
Folder and file security: identical
Binary compare of the application and all dlls: identical
I don't normally work with IIS and .NET, so I'm quite puzzled that my application breaks on one of two seemingly identical installations. I have run out of things to check. Any help or pointers would be greatly appreciated.
Here is the complete web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<authentication mode="Windows" />
<authorization>
<deny users="?" />
</authorization>
<identity impersonate="true" />
</system.web>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath="dotnet" arguments=".\MyApp.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: a447f5e7-6aee-4d26-bef4-c7111a88c409-->
I was also facing the same issue and it was because the machine
was missing the NET Core Windows Server Hosting bundle. If this is not installed then IIS cannot recognize the aspNetCore section in web.config
You can install the bundle from below location.
NET Core Windows Server Hosting bundle

IIS Can't Serve .LDF or .MDF extensions

I'm trying to serve the extensions .ldf and .mdf and even though files of these types actually exist on the server, IIS keeps throwing 404 error whenever they are requested.
I've double checked IIS manager and both extensions are added MIME-types of application/octet_stream. Is there perhaps some other setting or place I've missed that needs something set?
Thanks for your help chaps.
Adding the following to web.config worked as suggested by Sergey Kornilov:
<security>
<requestFiltering>
<fileExtensions>
<remove fileExtension=".ldf" />
<remove fileExtension=".mdf" />
</fileExtensions>
</requestFiltering>
</security>

Visual studio 2013 view project in browser gives internal server error

I am new with Visual studio 2013 and I am currently working on two projects started by another developer. With one project the view option works fine using IIS Express, but the second one gives me error 500 with the below details...
"HTTP Error 500.19 - Internal Server Error. The requested page cannot be accessed because the related configuration data for the page is invalid."
"Config Error: Cannot add duplicate collection entry of type 'add' with unique key attribute 'name' set to 'Access-Control-Allow-Origin'"
Config Source:
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Content-Type" />
Hope somebody knows about an error like this and how I can solve it. Thanx in advance
I suspect IIS is already sending an Access-Control-Allow-Headers by default and that is blowing up.
Typically when setting custom headers one usually does a prophalactic removal first:
<customHeaders>
<remove name="Access-Control-Allow-Origin" />
<remove name="Access-Control-Allow-Headers" />
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Content-Type" />
</customHeaers>
This insures your app works no matter what happened upstream in configuration.

CS0104: 'Scripts' is an ambiguous reference between 'System.Web.WebPages.Scripts' and 'System.Web.Optimization.Scripts'

My project is on MVC 4.
In it I can't access any of scripts function like #Scripts.Render("~/bundles/modernizr") as Scripts is an ambigious reference between 'System.Web.WebPages.Scripts' and 'System.Web.Optimization.Scripts'
I have following entries in my webconfig :
<pages>
<namespaces>
<add namespace="System.Web.Helpers"/>
<add namespace="System.Web.Mvc"/>
<add namespace="System.Web.Mvc.Ajax"/>
<add namespace="System.Web.Mvc.Html"/>
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing"/>
<add namespace="System.Web.WebPages"/>
<add namespace="Product360"/>
</namespaces>
</pages>
I updated System.web.optimization from package manager console, still it's showing me same error.
I can't figure out why it's intellisensing in System.web.WebPages instead of System.web.optimization.
Anyone has any updates on this?
Do you use WebMaxtrix / Web Pages or only ASP.NET MVC? If you're only using MVC get rid of this line
<add namespace="System.Web.WebPages"/>
And you shouldn't have a conflict anymore.
Note: you might need to restart Visual Studio for the namespaces to be handled properly in the cshtml files after the modification.

Resources