I have hosted asp.net mvc application as an application called "samples" inside default website in wwwroot folder in IIS7.0. The url www.website.com/samples will show the application but i want the url www.website.com to show the application.
I have set default document as below.
<defaultDocument enabled="true">
<files>
<clear />
<add value="Index.aspx" />
</files>
</defaultDocument>
Also i have placed the Index.aspx in root folder. I am getting the below error
The file '/Views/Shared/Site.Master' does not exist.
<%# Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
I have searched and found setting default document will work but getting above error.
Can anyone suggest the best way?
Your application should be deployed to the root folder for which the web site is configured for:
So in this example you deploy your application in c:\inetpub\wwwroot directly. No subfolders.
Related
I created a JSP file.
sample.jsp
<%# page pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>Insert title here</title>
</head>
<body>
This is jsp program
</body>
</html>
I placed it here in the samplejsp project.
samplejsp
`-- WebContent
`-- WEB-INF
`-- sample.jsp
I opened it on the following URL.
http://localhost:8080/samplejsp/sample.jsp
But it shows the following error in browser.
404 ERROR
The requested resource (/sample.jsp) is not available.
404 simply means "Not Found".
Either the URL is wrong (note: case sensitive!), or the resource is not there where you think it is.
Just verify the URL and/or verify if the resource is there where you'd expect it to be. You placed sample.jsp in /WEB-INF folder. This way it is not publicly accessible without calling through a front controller servlet.
Put it outside /WEB-INF.
samplejsp
`-- WebContent
|-- WEB-INF
`-- sample.jsp
If you want to keep it in /WEB-INF, then you need to create a front controller servlet which forwards to it in doGet() method as below.
request.getRequestDispatcher("/WEB-INF/sample.jsp").forward(request, response);
Finally "open" the JSP by just calling servlet's actual URL instead of JSP's fictive URL.
See also:
What is WEB-INF used for in a Java EE web application?
Calling servlet from JSP
doGet and doPost in Servlets
It's mostly related to your directory structure or packaging.
Can you please add your directory structure?
Similar to below -
src
|-html\
|-jsp\
Perhaps this should do it
<form action="sample.jsp" method=get>
<input type =submit value="submit">
</form>
Edit - WEB-INF does not allow direct access to JSP.
In my spring boot web application with JSP it didn't worked until I have added this dependency
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
even after configuring view resolver
spring.mvc.view.prefix: /WEB-INF/views/
spring.mvc.view.suffix: .jsp
If you find why this worked please comment.
I have a library that comes from a private nuget feed. I have the url and credentials for that but dont know how to connect to the feed properly with visual studio code. I am using dotnetcore framework.
I created a Nuget.Config file in the root of my console application with the feed url and username and password but this didn't seem to pick up the packages from that feed when imputting them in the project.json. Even doing a restore would produce errors.
Does anyone have an example of how they would set up a project to do this? I know it is not normal to have the Nuget.Config file in the project but this is a test project so would not live there once the project got past proof of concept.
My nuget.config looked like this
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="CustomRepo" value="https://nuget.feed/nuget/" />
</packageSources>
<!-- Used to store credentials -->
<packageSourceCredentials>
<CustomRepo>
<add key="Username" value="something" />
<add key="ClearTextPassword" value="thepassword" />
</CustomRepo>
</packageSourceCredentials>
<!-- Used to disable package sources -->
<disabledPackageSources />
</configuration>
Apoligies this is now resolved and working with the nuget.config file in the root folder. I dont know what I did. Only thing I did was re-type the whole xml but dont know what what would have done. Anyway it is working which is great.
I want to deploy an application outside the "deploy" folder of JBoss in JBoss 6.0.0
my folder names must be specified in URL syntax. For example, to specify that C:/rev/deploy be used for deployment,inside deploy folder I placed my war file i.e,ORNC.war so I edited my profile.xml as
<property name="applicationURIs">
<list elementClass="java.net.URI">
<value>${jboss.server.home.url}deploy</value>
<!-- Add your own deploy folder -->
<value>file:///C:/rev/deploy</value>
</list>
</property>
After this I restarted my server. Now I am trying accessing: http://localhost:8000/rev/deploy/ORNC,
I am getting an error resource not available. How can I acess it? Please help me
Finally I got the answer my question ,Actually we need to create a jboss-web.xml file with below coding
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>/rev/deploy/ORNC</context-root>
</jboss-web>
After that I placed this xml file in my WEB-INF folder of my WAR file.Now I can access my war file through http://localhost:8080/rev/deploy/ORNC
By referring this I get an solution for my question
JBoss 7: how to change a WAR context root
Thanks for Mr.simkam and Stackoverflow.
I am using Eclipse Luna and getting
Could not publish server configuration for Tomcat v7.0 Server at localhost.
Multiple Contexts have a path of /TestProject.
However I can fix this by making path for docbase = / in context string in server.xml as in context docBase="abc" path="/" reloadable="true" source="org.eclipse.jst.jee.server:abc"/> docBase="xyz" path="/TestProject" reloadable="true" source="org.eclipse.jst.jee.server:xyz"/>
So I wanted to know what role does attribute 'path' play in context and how do I fix it permanently. I have seen the path get carried over when I copy a application to another application.
Go to [workspace folder]->Servers->[Tomcat folder] then open server.xml file and search for <Context> tag. There will be multiple <Context> tags, remove the duplicates. Restart your server. Hope this helps.
This is related to the server.xml file. I had the same problem, and I just switched to a new workspace and now it works!
In your eclipse tomcat, open server.xml and search "/abc", you will get this line, please keep only one and remove duplicate lines
<Context docBase="abc" path="/abc" reloadable="true" source="org.eclipse.jst.jee.server:abc"/>
Go to [workspace folder]->Servers->[Tomcat folder] then open server.xmlfile and search for the <Context> tag. There will be multiple <Context> tags, remove the duplicates, something like this:
<Context docBase="service-name" path="/path of your service" reloadable="true"
source="org.eclipse.jst.jee.server:your-service-name" />
<Context ................... />
so remove this second <Context> tag.
I'm working on a GWT project in Eclipse and for some reason the .nocache.js file is no longer being built, but a .devmode.js is. I cannot find any setting that would control this. Could anyone point me in the right direction?
Edit: My gwt.xml is below
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='myapp'>
<inherits name='com.google.gwt.user.User' />
<inherits name='com.google.gwt.gadgets.Gadgets' />
<inherits name='org.adamtacy.GWTEffects' />
<inherits name='com.google.gwt.user.theme.clean.Clean' />
<entry-point class='myapp.Entry' />
</module>
Update
This appears to be related to the use of gwt-gadgets. Inheriting the library and the use of a class that extends Gadget as an entry point causes things to be built only with devmode.js and not nocache.js.
Has anyone therefore developed any Google Gadgets using GWT and deployed them successfully?
Update 2
Turns out this is not an issue, although it seems a bit odd. If Gadgets are deployed using the generated gadget.xml, then this references devmode.js and so things work as expected. The naming is off-putting though.