A web project was created in VS Pro 2013 on Windows Pro 8.1, on which a non-MVC Razor page was placed. The .cshtml page could be viewed correctly in IIS Express and in local IIS (8.5).
The project was loaded in VS Pro 2015 on another Windows Pro 8.1 machine but failed to render in either IIS Express or local IIS. The following error was displayed:
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.*
Could this be due to a difference in the build output from 2015 vs 2013, or due to an overlooked difference in webserver configuration (given that IIS Express behavior parallels local IIS)? What could account for the problem?
Addendum
I have found that VS 2015 added a file to the solution named .vs\config\applicationhost.config (folder was added at solution level). Too big to include the whole file here, so I can only show bits of it. Could any of this be relevant to the problem?
<add name="cshtm-ISAPI-4.0_32bit" path="*.cshtm" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="cshtml-ISAPI-4.0_32bit" path="*.cshtml" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="cshtm-Integrated-4.0" path="*.cshtm" verb="GET,HEAD,POST,DEBUG" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="cshtml-Integrated-4.0" path="*.cshtml" verb="GET,HEAD,POST,DEBUG" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
The project was created as a website, not as an MVC project. It seems to be problematic serving cshtml files directly in either IIS or IIS Express. Once converted to an MVC project, it all worked properly. That it ever worked seems to be due to some tenuous support for cshtml built into IIS, which isn't really guaranteed outside of a web application.
The Visual Studio templates don't really lend themselves to a gentle learning path - too bare in some ways, too overwhelming in others. After some trial and error, I've worked up a few samples which I hope will be more helpful for newbies:
https://github.com/Zenilogix-Carl/Samples
Related
[SOLVED] I created a BI project report, and I exported it on SSRS installed local,
the report works if displayed on the SSRS webapp Manager
http://localhost/Reports/Reports/ProgettoReport1/ReportVendutoProdotti1
I'm trying to display the report on an ASPNET WebForm page,
but I'm having trouble
my steps:
via NuGet I installed the UserControl Microsoft.Report.Viewer v 11.0.0
I created a WebForm .aspx page and I added the UserControl Report.Viewer, and I configured
it on the same page
/////////////////////////////////////
page code ReportVendutoProdotti.aspx
<%# Page Language="C#" AutoEventWireup="true" CodeFile="ReportVendutoProdotti.aspx.cs" Inherits="Pages_ReportVendutoProdotti" %>
<%# Register Assembly="Microsoft.ReportViewer.WebForms" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
ReportViewer1
</div>
<div>
<%--
System.Web.UI.ScriptManager
The Report Viewer Web Control requires a System.Web.UI.ScriptManager on the web form.
--%>
<asp:ScriptManager runat="server"></asp:ScriptManager>
<%--
The Report Viewer Web Control
the ReportServerUrl and ReportPath configurations were copied from the BusinessIntelligence_Reporting project published on the SSRS server, TARGET_SERVER_URL and TARGET_REPORT_FOLDER
<ServerReport ReportServerUrl=TARGET_SERVER_URL ReportPath=TARGET_REPORT_FOLDER />
--%>
<rsweb:ReportViewer ID="ReportViewer1" runat="server" ProcessingMode="Remote" Height="100%" Width="100%">
<ServerReport ReportServerUrl="http://localhost/reportserver" ReportPath="/ProgettoReport1" />
</rsweb:ReportViewer>
</div>
</form>
</body>
</html>
/////////////////////////////////////
run the project/solution, so to view the WebForm page with the report ...
get error message
/////////////////////////////////////
mozilla firefox
http://localhost:53119/Pages/ReportVendutoProdotti.aspx
webbrowser output error
ReportViewer1
Report Viewer Configuration Error
The Report Viewer Web Control HTTP Handler has not been registered in the application's web.config file.
Add
<add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
to the system.web/httpHandlers section of the web.config file,
or add
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
to the system.webServer/handlers section for Internet Information Services 7 or later.
The operation you are trying to run on "/ ProjectReport1" is not allowed for this type of item. (RsWrongItemType)
/////////////////////////////////////////
if I try to write the suggested configuration, I get another error,
SoluzReport1\WebSiteWebFormReport1\Web.config
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
<httpRuntime targetFramework="4.6.1" />
<httpHandlers>
<add verb="*" path="Reserved.ReportViewerWebControl.axd" type = "Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</httpHandlers>
</system.web>
/////////////////////////////////////
run the project/solution, so to view the WebForm page with the report ...
get error message
/////////////////////////////////////
mozilla firefox
http://localhost:53119/Pages/ReportVendutoProdotti.aspx
webbrowser output
HTTP Error 500.23 - Internal Server Error
An ASP.NET setting was found that does not apply in integrated managed pipeline mode.
Most likely causes:
This application defines the configuration in the system.web/httpHandlers section.
Possible operations:
Migrate the configuration to the system.webServer/handlers section.
You can do it manually or by using AppCmd from the command line.
For example, run appcmd migrate config "Default Web Site" from the IIS Express installation directory.
Using AppCmd to migrate your application allows you to work in integrated mode and continue working in classic mode and in previous versions of IIS.
If you are sure you can ignore this error, you can disable it by setting system.webServer/validation#validateIntegratedModeConfiguration to False.
Alternatively, pass the application to a classic application pool.
For example, run appcmd set "Default Web Site/" /applicationPool:"Clr4ClassicAppPool" from the IIS Express installation directory. Do this only if you are unable to migrate your application.
///////////////////////////////////////////
if the problem is the couple Visualstudio2017 and WebForm
I could try to use a page of a MVC project
otherwise I would be grateful if you can help me solve with the WebForms
///////////////////////////////////////////
PS my environment:
Windows10
visual studio 2017
ASP.NET WebForms
SSRS Reporting
"Visual Studio Development Server" to run the pages
message error
http://localhost:53119/Pages/ReportVendutoProdotti.aspx
HTTP Error 500.23 - Internal Server Error
An ASP.NET setting was found that does not apply in integrated managed pipeline mode.
solved by following this post
https://www.codeproject.com/Articles/872364/HTTP-Error-Internal-Server-Error-in-Visual-Studio
Step 1
Open Visual Studio and click in the name of Website Project currently opened.
Click on Property pane.
Step 2
Double click on Managed Pipeline Mode. This will toggle between Classic and Integrated Mode. You have to switch to Classic mode
Now hit the F5 button, here goes the output as usual.
http://localhost:53119/Pages/ReportVendutoProdotti.aspx
OK !!! now the report is displayed
SOLVED
Im creating a ASP.NET site, but i dont want to use SqlServer i want to use my pre-existing MySQL database as the default connection. ive set up a new schema for it and assigned a user, and changed my default connection string to this
<add name="DefaultConnection" connectionString="Server=THEIP;Database=THESCHEMANAME;Uid=THEUSER;Pwd=THEPASSWORD;" providerName="MySql.Data.MySqlClient" />
It seems to be able to connect to the DB alright (as far as i can tell?)
so now i figured i needed to change the default membership provider so that the login is ran through this connection, i did some looking around on the net and found this on the MySQL site
<add name="DefaultMembershipProvider" autogenerateschema="true" type="MySql.Web.Security.MySQLMembershipProvider, MySql.Web, Version=6.0.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" connectionStringName="DefaultConnection" />
So i replaced my default membership provider with this, ran the site from Visual Studio, went to /Account/Register.aspx (every other page works alright as of yet) and i get this error
Could not load file or assembly 'MySql.Web, Version=6.0.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Can anybody point out what ive done wrong?
The version of the assembly was wrong, i went into the refrence assemblies and found that the version is not '6.0.4.0' but is infact '6.6.5.0', changed the version no. and its all working fine now.
I have an ASP.NET application that I would like to upload to a host that offers a MySQL database. I am using Visual Studio 2012, .NET 4.5, Entity Framework 5.0, and I have installed MySQL for Visual Studio 1.0.2. I have been trying to connect to a local MySQL server, but I have encountered some problems.
At first I referenced MySql.Data and MySql.Data.Entity at version 6.6.5.0 in my project. But when I tried to do Update-Database in the package manager console, I got the following error:
System.DateTime System.Data.Entity.Migrations.Model.InsertHistoryOperation.get_CreatedOn()
This seems to be a problem with Entity Framework 5.0 and earlier versions of Connector/.Net - the MySQL connector for visual studio. Since the process was one of discovery, I unfortunately can't recall how my project came to reference MySql.Data and MySql.Data.Entity version 6.6.5.0.
I deleted the references, and then downloaded and referenced the same assemblies in version 6.7.4.0, using NuGet. This solved the error I got before, but now Update-Database gives me the following error:
Could not load file or assembly 'MySql.Data, Version=6.6.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies.
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I have solved this problem by including a specific DbProviderFactory in my Web.Config file:
<system.data>
<DbProviderFactories>
<remove invariant="MySql.Data.MySqlClient" />
<add name="MySQL Data Provider"
invariant="MySql.Data.MySqlClient"
description=".Net Framework Data Provider for MySQL"
type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.7.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
If I leave out the remove tag, I get the error:
Column 'InvariantName' is constrained to be unique. Value 'MySql.Data.MySqlClient' is already present.
I think this means that somehow my project still has a DbProviderFactory that serves version 6.6.5.0 of the MySQL libraries. But when I search the text files of my project, I can't find the string 6.6.5.0 anywhere.
At the moment this solution lets me connect to my local MySQL server, but when I publish the project to my hosting provider and go to the web site in my browser, I just get an error message. I would like to know how to remove the implicit 6.6.5.0-serving DbProviderFactory, both as part of my learning and because I think my workaround could be the reason that my web site doesn't work at my hosting provider.
As a clue in finding a solution, I find it suspicious that when I try to add a reference, I can only see (several versions of) 6.6.5.0:
But when I go to the NuGet manager, I only have version 6.7.4.0 installed:
Hope this helps.
I wrote a blog post on this subject, my project is available for download at the bottom of this paper.
I had to install (as noted in my article) MySqlDataEntity -Pre, which install the beta version 6.7.2 beta, to get good compatibility with EF 5, but I see that now the current version is noted 6.7.4, so I updated my project accordingly, and it works just as well, so I also updated the project to download from my blog.
Hope this can help you to start with EF and MySql.
BTW, in case this is not clear, you have to install, from NuGet, MySql.Data.Entities, which will also install MYSql.Data, as Entities is depending on it.
Anyone Please Help,
I believe this doubt is pretty out dated, but if any expert could nail it easily for me.
We have created an application using umbraco CMS and created a blog using BlogEngine 2.8 in Web Matrix, everything works awesomely fine in localhost.
When i moved complete website and blog to the staging server in iis6 am facing issues while i run my blog it loads fine, but while i click on Dashboard it throws me the below error.
Exception type: InvalidOperationException
Exception message: Could not locate Razor Host Factory type: umbraco.MacroEngines.RazorUmbracoFactory, umbraco.MacroEngines
I have already done the below:
Since i setup the blog in virtual directory, i commented out the inherited child application's handlers.
Am using the same application pool for both application and virtual directory.
Also, I added and removed the below in between in Blog web.config
<security>
<requestFiltering>
<fileExtensions>
<remove fileExtension=".cshtml" />
<add fileExtension=".cshtml" allowed="true" />
</fileExtensions>
</requestFiltering>
Added and removed the below key in app settings in Blog web.config
uncommented the below from blog web.config
<!-- you may need it if you have issuew with razor/ajax in admin cshtml pages -->
<buildProviders>
<add extension=".cshtml" type="System.Web.WebPages.Razor.RazorBuildProvider, System.Web.WebPages.Razor"/>
</buildProviders>
Please anyone of you guys let me know how to fix this.
long-time listener, first-time caller!
I’m trying to connect to MySQL using the ADO.NET Entity Framework. (Visual Studio 2010, .NET 4.0) I created a web project and another class library project to serve as my DAL. On my local machine, I have no problems, and I have also tried running with Medium trust. I’m able to fully control the db as expected.
When I deploy to my host (shared, medium trust) however, I keep getting errors. I have tweaked my web.config multiple ways: I’ve explicitly called my assembly in the connection string, I’ve used the wildcard mapping, I added references to the MySQL dll’s, etc.
<connectionStrings>
<add name="NamespaceContext" connectionString="metadata=res:// Namespace.Data.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null/DataModel.csdl|res:// Namespace.Data.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null/DataModel.ssdl|res:// Namespace.Data.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null/DataModel.msl;provider=MySql.Data.MySqlClient;provider connection string="server=myserver;User Id=user;database=thedatabase;password=password;Persist Security Info=True"" providerName="System.Data.EntityClient"/>
<add name=" NamespaceContext " connectionString="metadata=res://*/;provider=MySql.Data.MySqlClient;provider connection string=" server=myserver;User Id=user;database=thedatabase;password=password;Persist Security Info=True"" providerName="System.Data.EntityClient"/>
<add name=" NamespaceContext " connectionString="metadata=res://*/DataModel.csdl|res://*/DataModel.ssdl|res://*/DataModel.msl;provider=MySql.Data.MySqlClient;provider connection string=" server=myserver;User Id=user;database=thedatabase;password=password;Persist Security Info=True"" providerName="System.Data.EntityClient" />
</connectionStrings>
The error I keep getting is:
System.ArgumentException: The specified store provider cannot be found in the configuration, or is not valid. --->
System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.
at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
--- End of inner exception stack trace ---
at System.Data.EntityClient.EntityConnection.GetFactory(String providerString)
at System.Data.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
at System.Data.EntityClient.EntityConnection..ctor(String connectionString)
at MyNamespace.Web.Html.TestPage.EntityFrameworkTestButton_Click(Object sender, EventArgs e)
I talked to their support guys (who aren’t devs) but they said the MySQL connector is installed and in the GAC. I tried to use the DbProviderFactories section in my web.config, like the following:
<system.data>
<DbProviderFactories>
<clear/>
<remove invariant="MySql.Data.MySqlClient"/>
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.3.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"/>
</DbProviderFactories>
</system.data>
I was hoping I could control this and reference the provider in my project. I then receive the following error:
System.Data.MetadataException: Schema specified is not valid.
Errors: error 0194: All artifacts loaded into an ItemCollection must have the same version. Multiple versions were encountered.
MySql.Data.Entity.Properties.SchemaDefinition-6.0.ssdl(4,9) : error 0169: All SSDL artifacts must target the same provider. The ProviderManifestToken '5' is different from '5.0' that was encountered earlier.
error 0194: All artifacts loaded into an ItemCollection must have the same version.
(lots of the same error message was snipped for brevity)
I am at a complete loss. I tried strongly signing my DAL project, not using a DAL and just creating the .edmx in the web project, all to no avail. I could have sworn I got it working at some point, but perhaps I was delirious.
Sorry for the wall o' text. Can anyone help or shed some light?
Thanks!
What happens if you put the mysql dll in your bin folder? Alternatively, try to remove the version restriction on the mysql dll, they may not have that exact version loaded on their servers.
I had a very similar problem in my application, where I was using the MySQL connector for a MySQL database and the Entity Framework for a SQL Server database (two separate connections, one project). The MySQL.Data.Entity DLL seems to fight with the entity framework. I didn't actually need it so I removed it... but the error persisted!
Finally out of desperation I just deleted my bin and obj folders and recompiled. Problem solved. I guess something was cached or hanging around in my folders, even after I ran a clean and rebuild. Something to try anyways if someone else runs into this.