I am developing an ASP.NET application using a masterpage.
As default the master page is referred on top of all the pages as
masterpagefile="~/mymasterpage.Master".
My application works perfectly in the test environments under IIS 6.0 or 7.0
When I publish it to the server (under IIS 6.0 - for which I don't know the server configuration) it gives me an error for the master page URL.
When I remove the "~/" from all the pages it works perfectly but I would like to know the reason and also how can I change the configuration to make it work even with the following URL : "~/mymasterpage.Master"
Thanks
I found the problem; actually "~/" refers to application root and my application was inside a virtual directory instead of an application. I just converted the virtual directory to an application and it's working fine !
Related
I have inherited quite a complex web site project, and when I run it in VS 2012 under the default "Use default Web server" setting for "Server", it serves the login page correctly, under the base URL http://localhost:45632 and I can log in nicely. Then, when I click a menu item with the URL http://localhost:45632/Apps/Visitors/General.aspx, I get a good and plain 404.
If I then create a web site (not application under the default site) for it in IIS 7.5; set the physical directory to the project's source folder; give it a host name, xtjethro.local, and edit my hosts file to point that host name to 127.0.0.1; set the web site project to use a custom server, with a base URL of and finally, browse the site from its context menu, it serves its pages under the base url http://xtjethro.local/ instead of http://localhost:45632, everything works fine.
Then, if I set the web site project to use a custom server with a base URL of http://xtjethro.local, and restart VS2012, running it as administrator, everything works from there as well.
I would like to know why http://localhost:45632/Apps/Visitors/General.aspx doesn't work under VS2012, but http://xtjethro.local/Apps/Visitors/General.aspx does work under IIS.
The Visual Studio development web-server usually runs the site under a virtual directory which matches your project name. That would mean that the URL of your page should be http://localhost:45632/YourProjectName/Apps/Visitors/General.aspx. If you create an application under the default site in IIS, you will probably see the same problem.
You'll need to change the way your links are generated. Instead of using /Apps/..., use ~/Apps/... - ASP.NET will automatically resolve ~/ to the base path of the site.
I am having a problem setting up a website under IIS 7. I have created an application and the application pool for the application. Application pool is using .Net Framework 4.0 as my .net app is written in .Net Framework 4.0. Application pool is set to use classic Pipeline Mode. MIME Types have been automatically added to .asp & .aspx.
When I run the website windows explorer is showing me "View Downloads" and trying to download "application name localhost" when it downloads the file I notice that its the html of my default.aspx. I have checked Default Document and it contains Default.aspx.
If I remove .asp & .aspx MIME Types then I get an error: HTTP Error 404.17 - Not Found The requested content appears to be script and will not be served by the static file handler.
I have seen this problem many times. IIS is not serving aspx pages and most likely is not running for the entire server or that site.
For the entire server: Check to see if iis world wide web service is running.
For the site alone: Hit run inside IIS.
You can easily know if IIS is running properly by going to IIS and hit the browse option from inside a web site.
With the data you have put these are the things I would try in order if I were you:
Check in Server Manager/ Features if ASP.NET is installed (ServerManager/Roles/Web Server(IIS) look for ASP.NET
Check IIS Manager if everything is ok by:
Try to browse a test.html file to see if you are able to browse normal
Check Basic settings by clicking Test Settings
Check Handler Mappings to see if aspx is there.
Try to browse a sample test.aspx page with test data.
Check Application pool settings.
Reinstall Framework 4.0
Reboot machine ( a classical)
If you gave us more info and/or the ouput of my proposed tests maybe can help more. Good Luck :)
I had the 404.17 error happening on a server today. As you and cad mentioned, I checked the framework of the Application Pool that my site was using to make sure it was set to ASP.Net 4.0, and it was. What happened in my case is that my site was not using the application pool that I thought it was. My site was nested under another site, meaning my site pointed to a subfolder but another site was pointing to the root folder. Even though I had my site set to use the ASP.Net 4.0 Application Pool, the root site used a different Pool that had ASP.Net turned off, it was set to "No managed code". When I set the framework to 4.0 for the Pool the parent site was using, then my site started working.
In my case the solution was fixing the Handler mappings as explained here: http://forums.iis.net/post/1943489.aspx
IIS Manager->high-light you web site->click Handler Mappings icon on
the home pane->click Revert to Parent...
on the right Actions pane
In visual studio MyProject properties I set the Login.aspx page as startup page and it works fine when I use the local host, however when I publish to the external host server the startup page is ignored and the aspx page in the URL is displayed. What am i doing wrong? host server has IIS6, 3.5 FrameWork
Startup Action, and specific page in this case is only used for Debugging purposes, not for the initial page to load on your web host.
If your web host is using IIS7, you can use the <defaultDocument> web.config element.
Otherwise, you can set the value in IIS (see here), or possibly find a workaround elsewhere.
The startup page is only for the ASP.NET Development server that is created by Visual Studio..used for testing & debugging your code.
Since you're publishing to IIS 6.5, you can set your default documents(s) on the website's Documents tab in IIS. Add your default starting page to the list there & move it to the top.
On II6 if you right click the web site --> Properties then go to Documents, there is a Enable Default Document. That list is where the default document is set.
I have a problem with my asp.net 4.0 application. When I call it on the server, it works, but when I call it from outside the server, it gives me a 404 error.
The link I call the asp.net application from is the good one. Other asp.net 4.0 applications are working fine when called from outside the server. The other applications are in another folder though, but I do not see why it would work under a folder and not another one. There is no IP restrictions on the applications.
Anyone got that error int eh past?
Thanks
EDIT:
The app is configured as an asp.net 4.0 application. it is stored in a virtual directory.
This link works:
http://localhost/Phonebook/PhoneBook/default-defaut.aspx
this link does not : https://www.test.com/Phonebook/PhoneBook/default-defaut.aspx
A coworker and me found the answer. It's because the server I called on my url was supposed to have a rule redirecting the browser to the right url. So IIS7 on my test server was setted up right.
Theres several things to check.
That test.com is even going to your server. Put a file in the root directory 'test.txt' that IIS lists as the root folder for your site. ensure you can get to it.
Once you verify your root site folder WORKS for ex., www.test.com/test.txt then ensure you have a virtual directory /phonebook that contains a folder phonebook within it.
Seems overkill to be having to folders named phonebook. Try taking one of them out and pointing your web application to your
c:\whatever\phonebook\phonebook folder.
Make sure port 443 is bound to your app if you're using https, that could be your problem.
I had a website hosted in IIS. One small section of it needed asp.net. So I just right-clicked that section/directory and made it an application and a virtual directory.
Is that alright? Or does the entire "website" need to be made into an application and virtual directory?
The reason I ask is that when I try to browse to the aspx page in this "application", I am getting a parser error message "Could not load type...MyCodeBehindType" in the page directive, which seems to me to indicate that it is not finding the dll's, or even the code behind class files (which are clearly in the same directory).
EDIT:
If I do it this way, with only a subfolder of my website actually being a web application, where do I put the dlls? In a bin folder of the website the web application is within? Or in a bin folder of the web application?
Making just a folder within a website, an application, should be fine. I usually have to remember to change the version of ASP.NET from 1.1 to 2.x, that may be what's causing the error.
In order to test the configuration, start with a blank test page (blank.aspx) with just HTML. If the HTML shows up, you know IIS is serving .NET pages.
If there is a problem with ASP.NET not being correctly registered for IIS, you could try re-registering it. Open the following folder:
%WindowsDir%\Microsoft.NET\Framework\x.x.x\
and run:
aspnet_regiis.exe -i