I have a classic asp site, and an MVC web app. I have both of them hosted locally as localhost in my dev environment. I also have both of them set up on a remote server.
Below is a list of URLs of my apps:
classic asp site hosted locally: http://localhost/AspAppName/
classic asp site hosted on remote server (IIS): http://ServerName/AspAppName/
MVC web app hosted locally: http://localhost/MvcAppName/Dir/SubDir
MVC web app hosted on remote server (IIS): http://ServerName/MvcAppName/Dir/SubDir
What I am trying to do is have my MVC app ran within iframe placed on one of the pages of my classic asp site.
when I run my local version of MVC app within iframe of my locally ran classic asp site, everything works. In such case I use "http://localhost/MvcAppName/Dir/SubDir" as the URL to execute within my iframe and the iframe is on "http://localhost/AspAppName/SomePage.asp"
when I locally run my remote version of MVC app within iframe of my locally ran classic asp site, I get the following error:
"This content cannot be displayed in a frame.
To help protect the security of information you enter into this website, the publisher of this content does not allow it to be displayed in a frame"
In such case I use "http://ServerName/MvcAppName/Dir/SubDir" as the URL to execute within my iframe and the iframe is on "http://localhost/AspAppName/SomePage.asp"
The error shows up in IE. In Firefox and Chrome, the iframe area just ramains blank.
Just for testing purposes and to see if these are some cross-domain limitations/settings I tried putting my classic asp site hosted on remote server (http://ServerName/AspAppName/RandomPage.asp) within iframe of my classic asp site hosted locally (http://localhost/AspAppName/SomePage.asp). In such case, I do not see any errors and the local asp site displays iframe content with remotely hosted asp page without any issues.
Here is some application pool information from IIS on my local machine:
MvcAppName: .NET CLR version: v4.0, Managed Pipeline Mode: Integrated; Identity: ApplicationPoolIdentity
AspAppName: .NET CLR version: v2.0; Managed Pipeline Mode: Classic; Identity: NetworkService (!, ?)
Here is some application pool information from IIS on my remote server:
MvcAppName: .NET CLR version: v4.0, Managed Pipeline Mode: Integrated; Identity: ApplicationPoolIdentity
AspAppName: .NET CLR version: v2.0; Managed Pipeline Mode: Classic; Identity: ApplicationPoolIdentity (!, ?)
I strongly appreciate any advice on what might be causing my issue with nesting my remotely ran MVC app within iframe of my locally ran asp site.
Sounds like you need to return an X-Frame-Options header from the site that cannot be displayed in the iframe. This page shows the available options and how to set it up in various servers, including IIS.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
It turned out the X-Frame-Options setting was being overwritten automatically. To turn it off, I had to add the following line to Application_Start in the Global.asax.cs.
AntiForgeryConfig.SuppressXFrameOptionsHeader = true;
Related
I have been literally stuck for hours trying to deploy a Web API app to IIS. I can not believe there are no useful tutorials online anywhere that I can find. Here is my situation.
I have a VERY basic Web API app. It is using .NET Framework 4.0. It doesn't do anything I just want to see the home page at this point.
I am developing it in Visual Studio 2012 on my local machine. I can hit my localhost and see the home page, even post some data through Fiddler works great.
I publish the solution using Build->Publish to my local file system.
I then copy and paste everything in that directory to my web server (actually using a repository but for simplicity sake)
I created a brand new application pool in IIS. .NET 4.0 Integrated.
I placed the folder that contains my published code inside of the directory of my main website. The folder name is WebAPI.
I created a new website in IIS, attached to that new app pool I created.
I start the website, browse it on localhost and everything works perfectly.
I try to go to the website externally "website.com/WebAPI/api" and get a
403.14 - Forbidden The Web server is configured to not list the contents of this directory.
I'm sure I'm doing something wrong, I've never deployed an MVC app to IIS on another server. I'm able to deploy it just fine on my local machine through IIS too. What am I missing? Thanks!
Edit: Yes, my server has other .NET 4.0 apps running just fine.
http://localhost/api
http://website.com/WebAPI/api
Is this correct?
If so, looks like it could be a path problem.
I've setup an asp.net mvc app on a windows server 2003 machine with IIS6. ASP.NET MVC3 and .NET4 framework has been installed.
Now, I setup a New Website, New AppPool for .NET4 and then put a virtual directory under there with my asp.net mvc3/razor app. So:
IIS
+NewSite <<I set home directory to MyApp
++MyApp/ <<virtual dir
Here is the annoying bit, when I navigate to the address http://<MyServerIp>/ the home page for my app loads up. But, all other links/urls fail and give me a 404.
Like if I click Log On. The URL <myServerIp>/Account/LogOn gives a 404. Similarly all other urls other than the home page give me a 404.
I've gone through as many related questions on SO. I've gone through Phil Haacks article. I've setup a wildcard mapping for .net4.
Any ideas?
Make sure that .NET 4.0 is enabled in the web service extensions folder in IIS manager console:
Also make sure that ASP.NET is properly registered with IIS:
c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
I'm trying to deploy a MVC 3 site to IIS 7.5. The deafult route works but all links return a 404 error including if I manually enter the link for the homepage.
Details:
MVC 3 to IIS 7.5
Windows Server 2008 R2
MVC 3 is installed on server
Default Web Site/PaedPhysiotherapy_Uat
.net 4 is installed
DeafultApplicationPool used
App pool is .net4 and running in integrated mode
Custom error are turned off
If I deploy to a new website on the same IIS box using different ports, e.g. "http://newsite:81 which not under the default website everything works fine.
Even in the absence of routing, IIS will redirect requests for "/" to "/Default.aspx". In an MVC app, there's a Default.aspx which manually finds the MVC handler and invokes it. So that's probably why your home link works.
Your other pages must go through routing. In integrated mode there must be an IIS handler for this. Check the ExtensionlessUrlHandler in the IIS handler mappings. Compare that and other handlers with the sites which work.
At a guess, if this works when deploying to the root of a site then it looks like an absolute path has sneaked in. Perhaps somewhere this is a missing ~ in front of a path e.g.
/MyController
instead of
~/MyController
Also, you did remember to convert /PaedPhysiotherapy_Uat to an application?
Hi,
I have done the following :
Start Visual Studio 2010
New Project > ASP.NET MVC
Default ASP.NET MVC project generated by VS2010
Add a couple off simple buttons on the first page
Start local IIS manager, Create a web application and point it to the ASP.NET MVC project
Set correct right on the ASP.NET MVC project folder(to the user running the thread pool in IIS7)
Browse site (http://localhost/MyTestSight/) and the first page is shown
Upload site to www.test.figurspel.net
Host sets the site to be runned on .NET 4.0
Browse www.test.figurspel.net and the site is not working?
The host has checked that tha Active Server Page is set to allow
Host has installed up to MVC 3
I could turn on the Browsable to see the file structure but this will not help to get the site running.
How do I get this asp.NET MVC web site running?
BestRegards
Is the application pool running in integrated mode the IIS site running under that application pool?
It's my understanding that if this isn't the case, the MVC site will not run.
Alternatively, have you tried this?
+1 Unicorn power HooooooO!!!!! Also I've always when hosting a site published the project to a different folder then setup the site via IIS from that folder hope this helps.
I have joined a team developing an ASP.NET MVC version 1 application. I run this app on my local machine using IIS version 7.5. My operating system is Windows Server 2008 R2 Enterprise Edition. I use Visual Studio 2008 SP1 for development.
One of the controllers in this app is called ReportsController. The route table entries for this controller use 'Reports' as the controller name part. The problem I have is that, using IIS 7.5 on my local machine, I simply cannot access any of the Reports action methods. If I try to access, say, '/Reports/Index' from Chrome or Firefox, I get a 401 Unauthorized response (as seen using Fiddler) and the browser displays its username/password entry dialog.
Please note the following:
All other non-Report pages in the application work correctly.
If I add a breakpoint to Application_BeginRequest, it is not hit when requesting a Reports page.
If I change the Reports routing entries in the route table registration code so that I have to access paths like '/Reportss/Index' (note the extra 's') then these Reports pages work correctly.
I have tried deleting then recreating my Web application in IIS.
The Reports pages work fine if I run the application using the Visual Studio 2008 development server (Cassini).
There is no directory called Reports in the application directory.
The Reports pages work correctly on our UAT environment, also under IIS 7.5.
I have reviewed my IIS setting several times, including comparing them with those on UAT, and I can't see a problem.
While I can use Cassini to access the Reports pages, I would really like to understand what is causing this issue.
If you have Reporting Services installed on your machine. try to create a new web site and use it. If you have SSRS installed on your machine it uses /reports for hosting reports.
I have had problems using the directory name 'Reports' at the root of a .net 2.0 website on IIS 7.5. It generates a 503 Error, indicating that there is an error at the system level before IIS tries to serve the page. I am not sure if reporting services is installed on my server. I just changed the directory name, all links and everything worked.
I have the exact same issue in my MVC Application with reporting services installed on the same server where code was deployed. I have changed the Reporting Manager URL in "SQL Server Reporting Services Configuration" which was hostName/Reports and assigned a new name i.e. SSRSReports so the virtual directory is now hostName/SSRSReports.
Now my application as well as SSRS Reports are working as expected.