I'm developing web service on Visual Studio development server. Browser starts at project root directory and shows files list. I always must select required asmx file to run some tests. Is it possible to ask debugger to show webpage on required asmx address instead of directory list?
You can set default document on web.config file for specific asmx file name.
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="TestService.asmx" />
</files>
</defaultDocument>
</system.webServer>
Visual Studio runs the page that was currently in focus in your designer.
If you set this page, Visual web Developer will start your web site with the Set Page and not the current page in designer.
You can do this by right-click on the page and selecting Set As Start Page option from the context menu.
Related
I have an ASP.Net application. The application is working when the url is http://locahost/device.aspx but not working when the given url is just http://locahost. It is throwing an IIS exception and the IIS image is displayed when http://locahost is given
IIS image displayed
If you are using IIS, you need to set the default page in your IIS server. You can check the steps online as it varies from version to version.
Another way thorough web.config, you need to add following tag in your web.config file
<configuration>
<system.webServer>
<defaultDocument enabled="true">
<files>
<add value="device.aspx" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
Because you don't have a default.aspx page.
IIS searchs the Default.aspx if you don't define in the url the page that you want to display . If Default.aspx doesn't exist, it can't decide which page to display.
If you don't have a Default aspx, you should add your device.aspx in the iis manager to your site like on the image.
First, you should open the iis manager (you can type Windows + R to execute the command inetmgr in order to open the iis manager).
Than you expand the server and Default Web site and choose your application.
Double click on the Default Documents and add a new default documents like on the image.
If you want to refer the default web site to your application in order to use only http://localhost url, you can configure your iis like on the second image
We're building an ASP.NET MVC 4 app in Visual Studio 2015. The app uses Elmah.MVC for exception handling. We're three developers; for two of us it's working fine on localhost, but one developer is getting this error (captured by Elmah):
The controller for path '/favicon.ico' was not found or does not implement IController.
This post provides a solution, and I've modified the routes to include it and the developer in question has synced his code:
routes.IgnoreRoute("{*favicon}", new { favicon = #"(.*/)?favicon.ico(/.*)?" });
Now nothing shows up in Elmah but the user continues to see a generic error:
500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.
What could be going on? Thanks.
Update 1: Ripped out the Elmah stuff from Web.config and just had the developer load the app. It gets into an infinite loop trying to authenticate the user, similar to this.
We're using OWIN-MixedAuth, and the issue is more than likely on the IIS Express settings. I'll have the developer try it tomorrow and confirm:
Highlight the project in Visual Studio
Open the 'Properties' panel on the right (or press F4)
Set 'Windows Authentication' to 'Enabled'
Set 'Anonymous Authentication' to 'Enabled'
As the name suggests, it's mixed auth, so both types of authentication have to be enabled.
Update 2: The OWIN-Mixed Auth issue has been fixed. Now, it has something to do with these three HTTP modules in Web.config used by Elmah:
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" />
</httpModules>
When we comment them out, the one developer is able to get onto the site. What do these modules do? Why would they cause a problem?
Finally resolved the issue. We had to make two changes:
We're using OWIN-MixedAuth, and part of the issue was on the IIS Express settings (under "Development Server" section):
Highlight the project in Visual Studio
Open the 'Properties' panel on the right (or press F4)
Set 'Windows Authentication' to 'Enabled'
Set 'Anonymous Authentication' to 'Enabled'
Another part of the issue: a corrupted applicationhost.config file used by IIS Express:
Ensure you're showing hidden files in Windows Explorer.
Go to the root of your project via Windows Explorer.
Open the hidden .vs folder.
Go to config > applicationhost.config, make a backup, and open it in Notepad (Notepad++ is better).
Compare it to a working applicationhost.config file from one of our machines. We found lots of old sites that were listed in the config file which were not being used anymore.
Once cleaned up, launched the app and it worked.
Add this to your global.asax file.
routes.IgnoreRoute("favicon.ico");
I am working on hosting a website developed using asp.net to AWS. I have successfully published it to EC2 instance. I want to setup Index.aspx page as default page so that if someone open the URL it should automatically load index.aspx page e.g. typing www.domain.com opens up index.aspx page. I have tried all the options but somehow its not working for me. Any suggestions will be highly appreciated.
For IIS Web Server you should look at the web.config file.
Make sure you have <defaultDocument enabled="true">
The default files in recent IIS version are (in order)
index.htm
index.html
default.asp
default.aspx
index.asp
index.aspx
index.cfm
index.php
default.htm
If you don't enable the default list, you would need to make sure your index file is added to the list
<defaultDocument>
<files>
<add value="index.aspx"/>
<add value="..."/>
</files>
</defaultDocument>
I've hosted my Visual Studio project on somee.com and I'm having trouble setting it up there. I've uploaded all the files of the Visual Studio Project (data layer, lib, model layer, sln file, suo file).
I found out that in order to assign the default page you need to write that in the web config file. I've written the following lines in my web config file.
<system.webServer>
<defaultDocument enabled="true">
<files>
<clear />
<add value="www.omsshutter.somee.com/www.omsshutter.somee.com/Shutter 2000 Halloween/login.aspx"/>
</files>
</defaultDocument>
</system.webServer>
The login.aspx page which I want to be the default page does not come up. It's in the "Shutter 2000 Halloween" folder. How can get this working?
You need to use relative path to file instead of full HTTP path. i.e. Use following line
<add value="Shutter 2000 Halloween/login.aspx"/>
instead of
<add value="www.omsshutter.somee.com/www.omsshutter.somee.com/Shutter 2000 Halloween/login.aspx"/>
Method 1
You can always check the user state secured/user-visible master page.
If user isnt logged in from master page load simple redirect to login page (having public master page) using.
Server.Transfer("~/login.aspx");
Method 2
In your Global.asax.cs file, write the following:
public void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes routeCollection;
routeCollection.MapPageRoute("DefaultRoute", string.Empty, "~/YourDesiredSubFolder/YourDesiredDocument.aspx");
}
Explanation:
Application_Start code is guaranteed to run once and only once on the
application start.
The first line of code, gets a collection of the
URL routes for your application.
The second line of code, defines a
new route pointing to your inner page in the subfolder that you wish.
The second argument is empty to indicate that this route is used when
there's no specific page is requested and there's no Default document
existing.
I have a web service built for SharePoint 2007 that I am trying to port to SharePoint 2010. This web service is dependent on session state to function properly, but so far, I have been enable to get session state to work at all in SharePoint 2010. This web service runs as its own web application under t
he /_vti_bin virtual directory. I have tried all of the following with no luck:
Ensured the "State Service" service application is running.
Added the System.Web.SessionState.SessionStateModule http module to my application's web.config file.
Added the System.Web.SessionState.SessionStateModule http module to my SharePoint root web.config file.
Added <pages enableSessionState="true" /> to my application's web.config file.
Added <pages enableSessionState="true" /> to my root web.config file.
Additional Environment info:
Visual Studio 2008 - SP1
.NET 3.5 - SP1
SharePoint 2010 - RC
Windows Server 2008 R2
ASMX web service (not WCF)
Had anyone had any luck getting a web application or web service to use session state in SharePoint 2010 yet?
Thanks!
Steve
You've already answered this yourself somewhere else on the interweb. :)
<httpModules>
<add name="Session" type="System.Web.SessionState.SessionStateModule" />
</httpModules>
THEN, you must go into your web application and add the same session state module to the IIS7 managed pipeline.
Open IIS 7 manager, and find your web application.
Double click "Modules" in the IIS section.
Click "Add Managed Module..." on the right hand pane.
In the Add Managed Module dialog, enter "SessionState" or something like that for the name, and choose the following item from the dropdown:
System.Web.SessionState.SessionStateModule, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
After that, session state should be enabled for your web app/web service!
You may need to turn on the Session State Service. Use the PowerShell cmdlet Enable-SPSessionStateService. This will create a Session State database and start the service in SharePoint 2010.
Reference information:
http://technet.microsoft.com/en-us/library/ee890113.aspx
The best link I have seen on this is here: http://blogs.msdn.com/b/markarend/archive/2010/05/27/using-session-state-in-sharepoint-2010.aspx
Joshua's solution helped point me in the right direction but I had to make some variations for my scenario - an ASP.NET 3.5 Web Site deployed to the _layouts folder.
Here are the steps that worked for me:
changed the <pages> tag in the web.config for the Web Site to <pages enableSessionState="true" />
Added the System.Web.SessionState.SessionStateModule module at the Sharepoint website level (not the entire IIS level - that'll break the Central Administration, I tried :( ) as per #Joshua's solution. If you're deploying a Web Application instead of a Web Site, you'll want to add it at your Web Application level.
Adding the SessionState HTTPModule below to the web.config didn't seem to have an effect for me, probably because I was riding on Sharepoint's web.config as my project was a Web Site and not a Web Application. Not too clear on this issue.
<httpModules>
<add name = "Session" type = "System.Web.SessionState.SessionStateModule" />
</httpModules>
Do like below:
<modules runAllManagedModulesForAllrequests>
<add name="Session" type="System.Web.SessionState.SessionStateModule" />
</modules>
modules is an xml tag. I don't know why, this post is not taking xml tags..
Thanks
Carol