Ok so I uploaded an MVC3 application onto a server. The server is .net enabled. However when I go to the directory its under i am presented with this error:
Directory Listing Denied
This Virtual Directory does not allow contents to be listed.
I made sure that:
System.Web.Mvc
System.Web.Routing
System.Web.Abstractions
were set to copy local true.
I feel as if it may be because of two issues. Firstly it may be an IIS issue, which will require reading about virtual directory permissions.
or its because my project hasn't got what is effectively an index page. At the directory the layout is as follows.
bin(folder)
Content(folder)
Models(folder)
Scripts(folder)
Views(folder)
Global.asax
packages.config
Web.config
First MVC3 app Ive uploaded to a server, anyone know where im going wrong, or which one of the issues they think it is? If it is either of them?
Either add runAllManagedModulesForAllRequests=”true” in your web.config or apply QFE on your web server. More details in How ASP.NET MVC Routing Works and its Impact on the Performance of Static Requests
Ok, I'll give you a check list that might help you out, or at least point you in the right direction.
Have you installed everything for .Net and MVC to work? MVC might work just deploying /bin folder. Installing the RTM MVC3 package will probably save you some IIS/Site configuration.
Run this, just in case... aspnet_regiis -i.
Target your brower to a know page from your project, for explame /Home/Index. Remember the MVC routing stuff, if you try something like "http:/yoursite/views/controller/action" you won't get the correct response. Now, if you get an error here, it will tell you something useful, like an Authorization error.
Related
I have an ASP.NET Web API service. I have noticed that on Web Publishing Wizard there is an option called "Precompile during publishing". What does this option do? What is the impact by publishing with this option checked or unchecked?
I have googled and found this question. What effect does the new precompile during publishing option have on MVC4 applications?.
There it says:
If you have anything in App_Code, it will be precompiled into a DLL
before deployment. Without precompiling, this would happen on the fly
by the ASP.NET runtime.
Based on this I understand that If you have things in App_Code it is better to check this option, also I understand that performance increases, right?
There it also says:
If you don't have any files in App_Code and you want your site to
remain updateable, it doesn't seem to do much.
Where is App_Code folder? In my ASP.NET Web API REST project I do not have any App_Code folder. Instead I have App_Data (empty) and App_Start folders.
So in my case, as I do not have any App_Code folder, is it better to not check "Precompile during publishing" option?
I am trying to setup intranet IIS 8.5 (Win8.1) to globally serve .cshtml (Razor) files. The corresponding Application Pool is set to v4.0.
The files are simple Web Pages, not MVC. Here is an example of one:
<html>
<body>
#foreach (var i = 0; i < 10; i++)
{
<li>Item #i</li>
}
</body>
</html>
By removing the mapping of .cshtml files to System.Web.ForbiddenHandler on the IIS server's Handler Mappings I was able to get past the initial hurdle of ASP.NET telling me that
This type of file is not served.
However, the .cshtml files are now served verbatim to the browser, instead of being run through the Razor rendering process.
One would think that it should be easy to serve Razor pages from IIS, but it isn't. I need to somehow convince IIS to interpret these pages as Razor views; I suspect I am missing some mapping to the appropriate handler (I don't want MVC though - just simple Web Pages).
Here are some additional constraints:
I would definitely like to avoid including a bin folder with the requisite Razor assemblies in each of the sites on the server. The server hosts many sites, and I don't want to have to copy the bin folder everywhere. It should be possible to configure it globally, once and for all.
Ideally, I would not even need a local web.config for each site. The sites that are being served are a patchwork of technologies, containing .html, .shtml, .php, .asp, .aspx, and - hopefully - .cshtml files and should not be dependent on a single technology or config.
Creating a Visual Studio project is expressly out of the question. I should be able to use any text editor to modify the .cshtml files.
.NET Core is not installed on the machine and is not an option. Must use full Framework up to 4.6.2.
I am aware of many other SO questions that are similar, but don't quite solve my problem.
This question for example, was closed as "unclear" before it could have been answered, yet it was pretty clear to me! I am having the exact same problem.
The accepted answer to this question simply resorts to copying the bin folder. This is something I specifically don't want to do.
This answer says you can run an MVC application without installing MVC on your server, again by copying a bin folder into the local root. I do want to install Razor (but not necessarily MVC) onto my server globally.
Essentially, what I am trying to do is to use Razor syntax in a way reminiscent of classic ASP, or ASPX, without the baggage of MVC.
Can it be done?
I believe what you're looking for is a feature called ASP.NET Web Pages. If you use ASP.NET Core 2.0, the most recent new project templates uses Pages, rather than controllers and views. I've never read this doco, but I guess it should help you get started (or just create an ASP.NET Core 2.0 project from the new project wizard)
I am developing a project using vstudio 2015, when i tried to run it on another system i am getting following error, tried many solutions available here but unable to get rid of this.
Note: another systems has same configurations as of mine.
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Detailed Error Information:
Module IIS Web Core
Notification Unknown
Handler Not yet determined
Error Code 0x80070003
Config Error Cannot read configuration file
Config File \?\D:\Visualstudio Projects\SPARC\SPARC\web.config
Requested URL http://localhost:1396/
Physical Path
Logon Method Not yet determined
Logon User Not yet determined
Request Tracing Directory C:\Users\Syeds\Documents\IISExpress\TraceLogFiles\
Config Source:
-1:
0:
More Information:
This error occurs when there is a problem reading the configuration file for the Web server or Web application. In some cases, the event logs may contain more information about what caused this error.
If you see the text "There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined", this error is because you are running a .NET Framework 3.5-based application in .NET Framework 4. If you are running WebMatrix, to resolve this problem, go to the Settings node to set the .NET Framework version to ".NET 2". You can also remove the extra sections from the web.config file.
Warm welcome for suggestion and answers,
Thanks & Regards.
Restarting visual studio might help on this.
This usually happens when you have invalid configs in your {solutions_dir}/.vs/{project_name}/config/applicationhost.config. This file contains machine specific configuration.
.vs/* directory should be added to your gitignore if you are using git. So the contents of this directory never gets pushed to the main repo.
If this will not work.
Open the file {solutions_dir}/.vs/{project_name}/config/applicationhost.config.
Go to the sites section
Check the application if it matches the physical path that is configured for each site applications. IISExpress will look use the phyiscalPath as its based directory per application.
In my case Actual issue was directory, to solve it what i did was creating same folder directory (as in my system) into other system.
IIS was trying to find webconfig in D:\Visualstudio Projects\SPARC\SPARC\
So, i created folder "Visualstudio Projects" in D: and then pasted the project there and it worked..
There was no any problem in web.config or applicationhost.config or in any of the IIS configuration.
I have this issue when I have same project file (Solution file) in two separate folder. The project properties was same and port number for IIS Express was same. The issue is resolved when I created new virtual directory.
Change project URL in Project>Properties>Web>Servers>Project Url.
Please create new Virtual Directory.
Try open your web.config and search for a tag named <scriptResourceHandler>
Can you find more than 1 result?
If yes, try merging the two "scriptResourceHandler" to one.
I came across the solution of this genetic problem all across the internet and Stackoverflow, but none of them talk about the same after/on deployment. I also read this famous article . So, my website runs absolutely fine via VS 2010. However, I get this problem the moment I deploy my website using the copy tool of VS 2010.
There are three web.config files in. 1- root, 2- Users folder, 3- accounts folder. The tag exists in the web.config file in the root. The hierarchy of which looks like: domain.com / httpdocs / websitefolder / web.config. In the websitefolder there are Accounts and Users folders which further contain web.configs, but non of them have the tag.
What could possibly go wrong from the development machine to deployment? The error I am getting is on line:
Line 16: <authentication mode="Forms">
In the httpdocs, there are other projects with web.configs, can that be a problem? In that case, I also deleted their contents, but didn't help (but may be I should have done a better job? I don't know if this is what was required at all?).
Also, this is a website, so there's no bin or obj folder being created, none of that kind of issue. Please suggest, I am not able to figure out the problem. Thanks a lot.
Usually when you have multiple sites in sub directories of one site, inspite you delete a web.config, the problem will persist. In that case even the sub folders should be marked as an application.
Is the folder in which you have this website deployed an application in IIS? It is one main reason why this error could occur.
If its not, make it as an application and the problem should resolve.
Update: Seems you have used File System while developing your website.
Firstly install IIS server like "this".
Next you should create a virtual directory in IIS. See "this" . (in physical path, select the path upto your deployment folder)
Now run the website. If your problem is solved it means the issue is with the virtual directory in your remote server. So report them.
my application not working when I publish (only files needed to run this application) it to the server. I set wildcard mapping in IIS. I'm getting the error below:
HTTP Error 404.4 - Not Found
The resource you are looking for does not have a handler associated with it.
In integrated mode, the web.config on my box (2008 R2, IIS7.5) requires UrlRoutingModule to be added to the system.webserver/modules section and UrlRoutingHandler to be added to the system.webserver/handlers (as in many of the examples I have seen posted). The routing refuses to work if UrlRoutingModule is added to !
So are you saying that your code only doesn't work when you upload the published version of your application?
Are you pre-compiling the application or getting the server to do it?
Can you hit a .html page directly and a .aspx page directly?
Sounds like you are deploying to IIS 6, here are my IIS6 deployment notes for one of my apps which is 3.5 with url routing:
Add read / write
Add Default Application to Application name
Under configuration add a wild card mapping: add aspnet_isapi.dll, untick verify that file exists
Change ASP.NET version to 2.0
Under directory security add IUSR Anonymous and password.
make sure the directory has ASPNet user and IUSR accounts added in security folder tab.. v important
Hope this helps!