Add dataset issue in ASP.Net application - c#

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.

Related

How do I run an already existing asp.net mvc application om my local server

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

Unable to find ASP.NET Web Service in file

I am trying to develop a web service application. I am following this website to develop the web service, as from the instructions when I open the VS2013 and Select File -> New -> Web Site in Visual Studio, I did not found this Asp.net web service. I got as below image.
Do I have to install any templates?
I have also tried to Installed the web service template by online but when I click on it and searched I got nothing, like my below image.
Can someone help me to do it.
Note: I am connected to Internet.
please follow below steps:
Right Click on Project/Application
Select Add new Item
Select Installed Tab
Select Visual Basic or Visual C#
Find Web Service (ASMX)
It depends what kind of web service you want to create really.
In your example you're using the "New Web Site" dialog.
More modern web services (Web API etc) instead use "New Project" dialog. Open that and choose "ASP.NET Web Application" and you can choose what you want from the subsequent dialog.
See here:
I got it, I have the change the .Net framework from 4.5 to .Net framework 3.5.
Thanks for your time and your help :)

Where and what is built in C# Web API 2

After successfully following this introduction to Web API 2 (although unable to "run" by pressing f5) I am really confused as to what is built and what is run when you create a WebAPI2 project. The only way I was able to test if it was working was by right clicking the project and clicking View -> View in Browser. I can't seem to find any .exe in the build folder (the app does build fine) to run.
What exactly is built and what is required to run a WebAPI2 projecT?
Your only output in a web project are a bunch of DLL's and maybe some static files that you could be using in your project (see this link about ASP.NET Web Project Folder Structure) . You don't have a .exe or an executable file in this case. Your built app requires a web server in order to execute, and when you are developing a project you have some options. Check this link about Web Servers in Visual Studio.
In order to run your project pressing F5, check if your ASP.NET Web Api project is configured as startup project. Check this link about how to configure it.
If you are still having any issue trying to run your web application in Visual Studio, please provide us with more information about your problem or errors, so we can provide you a better answer.

Transfering ASP.Net Website Project From One Computer To Another

Ive been working on a project on my computer and i want to transfer it to my laptop. The project is an ASP.Net Website Project in C#. I'm using SQL Server 2012 to hold my database and the Asp.net user management tables in my database also.
What's the easiest way to do this, as i have backed up my database and copied the ASP.net website folder onto my laptop and changed data source, but I'm getting a few errors, especially on the asp.net configuration page it has also removed my roles due to the transferring.
If i understood you correct, what you need is to deploy the ASP.NET Membership Database to the new project location. There are set of tools and commands that you need to use.
You would need to construct a command-line like the following:
C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe" -verb:sync
-source:dbfullsql=" [your connection string] "
-dest:dbfullsql="c:\temp\InsertIntoAspNetDB.sql
Again the exact path and command will depend on your local configuration.
You may get more detailed information from MSDN - How to: Deploy a Database With a Web Application Project

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