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.
Related
I am front-end developer trying to brush up the front-end of an existing asp.net mvc application. So I have never used asp before but I thought I would try running it locally on my machine then get to work on the css part of the web application.
Previously I have tried running IIS server locally but in vain, is there a better way to run this project? Sorry I am not allowed to share the repo from where I have cloned the project.
I am using Visual Studio code running on a Windows 10 machine.
I would suggest using Visual Studio. It has its own IIS Express so you can run app locally and open it in any browser and you can also edit all HTML and CSS files.
The Best way to use latest Visual Studio and import your project into it (File->Open-Project/Solution) and run the application in it in debug mode. You can put break point to go through the code and add new codes and even test your application. It is very easy indeed. It has all the utilities for a .NET MVC application.
Open IIS, go to Under Default Web site.
right click and add select Add Application
give alias name and select the physical path of your source code
click Ok
if you get database access Authorization failed.
Open SQL Express Management Studio as an “Administrator” and navigate to Security > Logins > NT AUTHORITY\SYSTEM
Right click on “NT AUTHORITY\SYSTEM” and select Properties. Select “Server Roles” from the left panel and make sure that “public” and “sysadmin” are checked.
Your application will be added under Default Web Site
from there you can browse.
You can have a look at very good article,
how to deploy ASP.NET MVC application on 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
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
I just started with WCF rest services and I've created a very simple project.
I can access it by
http://localhost:3349/VUXServicePrototype.svc/test
and see the text on the browser.
Now my question is how can I deploy it on the IIS? I can see it on IIS Express but how can I move it on the IIS?
You can build (I prefer publishing) to a directory.
Open IIS.
Select the app pool node.
Create a new app pool targeting your asp.net version and set it to integrated.
Select the site node you will use for the domain or localhost.
Left click add new web application.
Set the app pool to the app pool created in step 3.
Set the physical path to the folder created after the build.
Set a default document if needed.
Select content view and select the default document or the app node if no default.
Click view and test.
To deploy a WCF service once you've finished development, an easy way is to use the visual studio deploy tool. Right click on your service project, and click publish. Click the dropdown, and create a new profile.
You can either deploy directly to the IIS server, or deploy to the file system so that you can setup IIS yourself.
I am using VSTS 2008 + C# + .Net 3.5 + ASP.Net + SQL Server 2008 Enterprise to develop a simple web application.
In MSDN library topic "Walkthrough: Using a Database Data Source with the ReportViewer Web Server Control in Local Processing Mode", which is located in the following Url, http://msdn.microsoft.com/en-us/library/ms252123.aspx
I am following the steps in section "Define a data connection and DataTable by adding a DataSet", step 2, which says,
In the Add New Item dialog box, select DataSet and click Add. When prompted if you should add the item to the App_Code folder, click Yes.
My question is when I click add for a data source, the DataSet1.xsd is added directly into my project, no additional prompted to ask if I should add this item to App_Code folder.
Anything wrong?
BTW: I am working under an ASP.Net application, not a web site type project.
BTW: I am working under an ASP.Net
application, not a web site type
project.
I think that is the reason why you don't see that prompt message. For a Website project, every code file should go into App_Code folder but for a Web Application project, that is not the case.