Publishing WCF Rest on IIS - c#

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.

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

how to host asp.net app locally

I have a ASP.NET website, developed by a freelancer. After developing the website, he directly uploaded the website to my domain. Now, how can I host that website locally on my computer?
I dont have any experience in ASP.NET, however I do know HTML5 and CSS3. Looking at the files, I noticed they are all .cshtml files.
Any help would be great. I have the login credentials of Plesk.
Thanks in advance
You need to use IIS.
To do this, assuming you are on Windows, you need to enable it under the 'Windows Features' setting screen as below:
Check the 'World Wide Web Services' option, and also 'IIS Management Console' under the 'Web Management Tools' section.
After it installs, you will have a new program in your start menu, called 'Internet Information Services (IIS) Manager'.
This is where you setup and configure any local websites. There will already be a default website set up, which you can use, or you can create a new one by right clicking on 'Sites' in the tree on the left, and selecting 'Add Website':
Assuming you just use the default, you will need to copy your application to C:\inetpub\wwwroot\. You will then be able to access this by pointing your browser to http:\\localhost or http:\\127.0.0.1.
Assuming you are working with Windows, you will need to install an IIS on your machine. IIS is a part of Window's features, you can try installing it under:
Control Panel > Program and features > Turn windows features On / Off > Internet Information Services.
In some versions of windows, IIS is not available. In that case, you will need to download IISExpress.
After that - Configure a new website under your IIS, and point the website to the directory in your computer which has the project.
Read more here:
Installing IIS
Setting up a website

Publish a web service on Visual Studio 2010

I created a web service in C#, using Visual Studio 2010 ( Framework .NET 3.5). In debug mode it works great, but now I must publish it on the internet, so that I can consume it in remote (the app that will consume the web service is an android app).
So the question is: how do I publish my web service on Internet so that I can consume it in remote?
Thanks in advance; this is a work for taking my degree!
A simple way: you switch to release mode, update your web.config for production, right click on your service project and from the menu select publish. Then you publish it to the local folder. This way it copies only the files needed. Then you copy the contents of the folder to your remote site using ftp, for example, your hosting provider should have given you the credentials.
for some hosters it is also possible to publish directly but I don't use this.

How do I get the asmx web service file in Visual Studio 2012?

I need to deploy a asmx web service to a server. I can run the service locally and it runs fine but where is the asmx file kept? In my project folder I can only see the solution file. This is my first time dealing with web services so forgive me if this is a stupid question. The service is written in C# if that makes a difference.
On your project, select Build Menu -> Publish. There are many publish method, but for simple way, you can choose File System. Define Your Target Location and click Publish. When it's Done, go to your Target Location using Windows Explorer and you will get all file that need to move to your IIS server virtual directory.

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