Change the baseUrl for a Website project in VS2013 - c#

I have a website project and it was all working fine until I updated my OS to Win8.1 this morning. This also included VS2013 which I used earlier as well but on Win 7. I had to configure the IIS Express to use proper authentication settings and allow parts of config file. That out the way, I fired up a website project and it had lost its baseUrl property ie. everything crashed. We have to use baseUrl as we use it in production sites like www.xyz.com/myApps/Calculator & www.xyz.com/myApps/RaiseABug etc.
Since, the project does not run in VS2013 at all... I did a bit of research and found this :
http://connect.microsoft.com/VisualStudio/feedback/details/793989
and
http://forums.asp.net/t/1978467.aspx?Can+t+change+URL+for+ASP+NET+website
but none of them really answer the question. And the workaround in my first link doesn't work. The option to set the baseUrl is greyed out and changing it in the solution file doesn't get affected.
So, may I take this opportunity to ask you.. HOW DO I CHANGE THE BASE-URL and GET IT TO WORK WITH IIS-EXPRESS
This image shows what I get when I try to edit the url from the VS2013 front-end.

To specify the remote Web server for a Web site project
In Solution Explorer, right-click the name of the Web site project
for which you want to specify a Web server, and then click Property
Pages.
In the Property Pages dialog box, click the Start Options tab.
Under Server, click Use custom server.
In the Base URL box, type the URL that Visual Studio should start
when it runs the current project.
http://msdn.microsoft.com/en-us/library/vstudio/ms178108(v=vs.100).aspx
If that option is unavailable, check this article
Make sure you have most recent release of VS.NET 2013
Modify *.sln file (as described in the above link) and add required url and set UseIISExpress to false

Related

Asp web page isn't loading from IIS

So I am very new to web hosting. I am simply trying to host my asp website locally, but when I try browsing through IIS it just loads and never shows anything.
Here it is in the directory:
And here it is in IIS:
Then I just started the application pool and then clicked browse. Am I not doing something right?
You need to use a browser to view your website locally. Not the file explorer.
You can try localhost as url first, if that does not show your site follow the steps below.
Open the hosts file, located in C:\Windows\System32\drivers\etc
(it could be read only so you may need to change that attribute)
Add a line to this file, eg 127.0.0.1 www.medwebtest.com and save
Right click medwebtest your website in IIS left pane and select
edit bindings
Add the url www.medwebtest.com to the site as a new binding.
Reopen the browser and navigate to your new url.
So the solution I ended up going with was installing UltiDev and running my webpage from that. Honestly it felt far easier to use. I just installed it and selected my files and it worked. I was hoping that's how IIS would work but it still kept throwing errors for me.
I had a similar issue, on my new installation of windows.
turns out that I have not installed features for IIS using the following screen
Once the features have been installed, the website started working again.

How to deploy an ASP.NET application to localhost using IIS?

I'm trying to deploy an ASP.NET application to localhost using IIS, I've been reading a LOT of tutorials and following them step by step but I just can't seem to make it work...
I created an Application Pool(TestPool) with .NET version 4.0 and gave it every permission to the folder where the application is at.
I then added an application to the Default Web Site and tried to run it at
http://localhost/TestApplication/
But I keep getting:
Any idea what is wrong and how can I solve this?
Versions:
IIS version: 6.2
OS: Windows 8.1
VS 2013 Ultimate: 12.0
VS .NET: 4.6
PS: It's my first attempt at deploying an ASP.NET application so if you need any further information just leave a comment.
EDIT:
It is now running at least thanks to Julian and Marge, but when I run it using VS it has the default view, why isn't it showing when I run it through IIS? When running through IIS it just lists the files:
This error is because your website, in the IIS Server, does not have the Directory Browsing enabled and the default document (default page of the site ex: Default.aspx) configured.
Go to IIS Server IIS > Default Documents and check if the default page of your site is listed, if no, add the page.
Check the related link:
https://support.microsoft.com/en-us/kb/942062
Generally speaking, you do not need to access IIS manager at all to run your webpage on localhost. All what you need to do is right click on the project and then choose properties. In the Web tab you will find Servers section. Make sure the Project Url is something like http://localhost/myproj or simply http://localhost/ then hit Create Virtual Directory. Your webpage should be up by then, and you can access it either in debug mode, or simply by navigating your browser to the Project Url you have chosen.
When you add web application in IIS ex.
That your hostname should be to add in host file which is C:\Windows\System32\drivers\etc"\hosts
ex.
127.0.0.1 test.pln

VS2008 debugs old ASP.NET web service

I'm writing an ASP.NET web service, in C#. Before yesterday if I wanted to debug it I would just press F5, and ASP.NET Development Server would start hosting my service. Breakpoints would be enabled and would work. Recently this functionality is gone. Now when I start debugging, Development Server is started but the old version of my web service is hosted, and breakpoints do not work. I get a warning that versions do not match.
It does not help if I rebuild everything, or change the assembly version, or even change the file name of the DLL. It does not help if I delete the whole temp folder %TEMP%\Temporary ASP.NET Files. Old web service will be pulled out from who knows where, and stored in temp folder again.
Major change before yesterday was that I had installed IIS. Web service that is installed there works as expected, but I need to debug it as well. I thought that the problem is that I installed the web service (with vdproj), so I uninstalled it, but this did not help either.
How to prevent the system from caching the old version of web service. Where is this old version stored anyway?
Check the Web settings on your ASP.NET project. To get back to using the ASP.NET Development Server for F5 debugging make sure the "Use Visual Studio Development Server" radio button is selected under the Server heading. I also specify a specific port so other projects in my solution can consistently reference it (in my case I'm dealing with a web service). There's a good chance that you will find the "User Local IIS Web server" radio button selected.
Hope that helps.
EDIT: The problem here is not about IIS, but about changing the target build output folder of web service. It must be bin\, or Development Server cannot find it. Rebuild did not help because it would change dll file in new folder, but old file would remain undisturbed in bin folder.

How can I deploy an asp.net application using Visual Studio 2008

I am trying to publish a website using IIS, I made a virtual directory and in this directory I've added all the webpages and configured the virtual directory but still I am not able to run my web application.
Here is the step by step method to deploy an asp.net application
http://www.15seconds.com/issue/030806.htm
Please post any error message
Make sure that your are running the right asp.net Version...
check if in the asp.net tab if it's v 1 change it to v2
Could you please let me know the error message.( Check with minimum settings like startUp page , version, try publishing with Wizards etc)
In Visual studio, click on project, Properties, Web.
Under Servers, select Use local IIS Web server, then on Create virtual Directory.
Now, when you debug, the page should open in IIS, and Visual studio has taken care of most of the grudge work of setting up the IIS, all you will probably have to change is the security settings under IIS. Hope this helps.
If it is IIS7 check that your application has enough permissions to run:
IIS Actions Pane:
Basic Settings
Connect as (be sure to log in with Admin account first to test, then create you own specific user. Least Privilege Principle)
Test Settings (Authorization and Authentication is Green!)
Test your webisite
The question doesn't say what exactly the error is but you mentioned that you just created the virtual directory. Did you make it an web application? For IIS 6 follow this
link - Create and Configure Local ASP.NET Web Sites. In IIS7 just right click on it and convert it to application.
If its already a website, did you choose the correct framework? normally when you create a website it ill be assigned the default app-pool. If you have installed multiple dotnet then you might check which framework is in default app-pool. Then change the default app-pool to the correct version that is required by your website, or create a new app-pool.
There can be multiple reasons so if you could provide the error message then it would be easier to resolve the problem.
Thanks.

How to add a .NET C# project to a web site?

I just finished my first C# project in VS 2008 and it is working well now. But now I need to publish this project on my website. This project interacts with my SQL Server 2008 Adventureworks database on this same computer.
I will use this same computer to host the website and house this database. I know HTML but not how to add a .NET project to a web site, especially one that also uses SQL Server. Can u offer me tips as to how to proceed?
I started by right-clicking the project and selecting "Convert to Web Application" and then I selected the URL for my site. But then when I went to this URL, it still shows the original image.
In IIS create a website and point it to a directory that you want to put
your website in.
Make sure the website properties has the default document you want
and the ASP.NET tab has the framework you want.
Use the menu in VS2008 to publish to this directory.
Change the connection string in your Web.Config to point to the
correct database.
Asp.Net has two types of projects: website and webapplication project.
It looks like me that you are using the website project because you have the option to convert it the web application project. Right click your project, go to properties, go to "MsBuild Options" tab, you will see an Output folder, by default, it should have some path called "PrecompiledWeb", that's where your output is, and you need deploy this to your IIS directory.
you can't convert a windows application to a website, you have to built it from scratch.
you can go to file -> new website -> then you choose ASP.NET website.
you might also use the sqldatasource and gridview controls, they help a lot.
to run your website you can hit F5 or just right click your defalut.aspx page and select show in the browser!
check this for more information http://msdn.microsoft.com/en-us/library/41b1tfyt(VS.80).aspx
hope it helps
If your asking if you can move the location of the ASPNETDB away from the root of the project, yes, you can. There are database connection string nodes in the web.config as well as a master-default db config in your Visual studio master.config file. i think there is also a aspnetdbreg.exe or something like that to update the registration of this after you change its location.
Personally, I use visual studio 2008 and my ASPNETDB is on my SQLServer express 2008 instance. Visit my blog for more info on this stuff.
Since you are using IIS 7.0 what you need to do is find a place for your web application to reside (e.g. C:\mywebapp).
Then open up IIS 7.0 Manager.
Expand your computer name on the left.
Expand Sites.
Right click on Default Web Site (I'm assuming you are using the Default Web Site, if you aren't substitute your site name for Default Web Site) and click on Add Application.
Type in an alias for your application. This will be the name you use to access the site (e.g. if you want the url to be http://localhost/myawesomewebapplication/ from your local machine then type in myawesomewebapplication for the alias). Click the ellipsis (the ...) next to Physical Path and browse to the folder you copied your web files to (e.g. C:\mywebapp). Click OK. Click OK to close the Add Application window.
Assuming no errors, you should now be able to browse to http://localhost/ and everything should be peachy.
In my point of view, its simple. Let´s try:
If you want to access your DB from the web app:
1. Create an New ASP.NET Web Application (File > New > Project > Visual C# - Web)
2. In Project Properties (right button on project) go to tab "Web" and under "Servers";
Select the radio "Use Visual Studio Development Server", if you dont need to create an IIS virtual dir.
Select the radio Use IIS Web server, if you need to create an IIS virtual dir. Note that you can create the directory by clicking directly the button "Create Virtual Directory".
You can create a Class Library (File > New > Project > Visual C# - Windows) to access your DB and then, reference this assembly in your Web App. Just ask if you want that way.

Categories

Resources