Host a third party application on windows azure - asp.net

Hi I have a website made it in ASP.NET, I don't have the code to create the web role instance, but I have already hosted my application in a virtual machine. Does anybodoy knows if can I host this application in a windows azure instance? Thanks.

If your ASP.NET project is a web site and not a web app, its a little complicated. If its a web app, converting it into a Web Role is simply a matter of adding a cloud service project to the solution and then right-click on the "roles" branch in that project and "add existing web role in solution" option. You can then select your ASP.NET web app and poof its a web role. All that remains is to add any customizations you want (not required) to allow the web app to properly take advantage of the Windows Azure environment.
If its a web site, you'll first need to convert it into a web app. This really isn't any different then converting it to a web role. Which is just a matter of creating a new empty project and copying your old project's content files into the new project.

Related

Host a Web API under a Web Forms project

I have a ASP.NET Web APi project that uses an AngularJS as the front end. It is called "MyApiApp".
http://localhost/MyApiApp
I would like to move this project under another project that is an ASP.NET web forms website. It is called "MyWebForms" app.
http://localhost/MyWebFormsApp
My goal is to move the "MyApiApp" under the Web Forms app and access the "MyApiApp" as
http://localhost/MyWebFormsApp/MyApiApp
Is it possible to have an ASP.NET Web API hosted under an ASP.NET Web Forms project? I would like to be able to do this in Visual Studio where I could run that Web Forms application but have access to the "MyApiApp" app via the above URL.
Yes. You should be able to set it up as a virtual folder in IIS underneath the main website.
In the case of the VS Project, the built in web server doesn't support virtual folders, you'd have to set it up to run through actual IIS.
You should be able to have the WebAPI Controller as part of the main web forms project though.

ASP.NET Core Web API living inside a ASP.NET 4 IIS Web Site

I am tasked to to build a Web API application. The app will be hosted inside an existing web site - a pre-ASP.NET 5 web application with a WCF web service.
I wonder - can I build the web-api application using ASP.NET Core 1 in a way that it can happily exists as a sub application inside the already existing site in IIS?
Thanks!
Yes, this is possible, I'm doing the opposite of this scenario but conceptually its the same thing. You need to create your subsite as a separate application in IIS with its own app pool. That app pool needs to be configured No Managed Code per the instructions on the Docs site https://docs.asp.net/en/latest/publishing/iis.html
The only other thing you need to watch out for is that the web.config in the subsite will inherit some settings from the root web.config, so you need to remove or clear things sometimes like handlers, modules, etc.
If I understand you correctly it is not possible what you want. Please refer to the following documentation about hosting ASP.NET Core on IIS: https://docs.asp.net/en/latest/publishing/iis.html.
If you specifically look at the .NET CLR version in the application pool it should be "No Managed Code" while your current website is set to a .NET framework version I assume. This is because ASP.NET Core is now cross plaform and completely web server agnostic. It even needs a little 'trick' (the ASP.NET Core Module) to work on IIS. See: "The module creates the reverse-proxy between IIS and the Kestrel server."
But if you follow the link provided above I think you'll manage to work it out.

How to protect ASP.NET MVC/IIS application from copying?

We are developing intranet base solution in ASP.NET MVC. It will be deployed across client's own internal network hence respective employee of client can use it.
As it is IIS based intranet application, one can easily copy files and configure IIS on other server. So what are the different solution available to prevent this.
Thank you in advance.
Generally when you are publishing the ASP.NET MVC web app, you can publish the version in dlls.
So Instead of creating a single Web App, you can create a new dll file where you are going to compile all the Models of the App and save it in a dll).
Then coming back to your original solution you will add the reference to this dll so no logic can be taken of your solution.

Do I need to select web Site or Web project?

I am completely new to .net framework. I have to build a website that contain real time updating graphs.
data takes directly through MS SQL database via web service. (Website contain graphs only which should update time time)
I noticed that VS 2015 has 2 options. web site and web Application.
Which one should I use for my project. Please guild me to select best option.
IMHO Web Application all the way. And use the publish wizard to deploy.
Web sites do not have a project file: everything in the project folder (and subfolders) is part of the project. This seems nice and easy until you want to be able to include/exclude things. It also assumes all the compilation is done on the web server (on the first load of each page). In practice in the medium to long term leads to work-arounds that would be unnecessary in a web application.
web Application. Click on start Page -> New Project -> ASP.NET Web Application
Click on File -> New Project -> ASP.NET Web Application

Adding a Single Web Service to an Existing ASP.NET Application

I've written an ASP.NET website along with a companion WinForms desktop application, which is used to maintain the site.
The desktop application needs to create a user. However, this is awkward because I would need to ensure all the membership settings are exactly the same as they are in my website's web.config file.
It would be easier if my desktop application could "call into" the website somehow and tell it to create a user. It seems like a web service would be a good option for this. However, Visual Studio doesn't have an option to add an ASMX file. And if I create a separate, web service application, then that application would have the same problem my desktop application has.
Is there a way to add a single web service to an existing ASP.NET application? Any links? Thanks.
Visual Studio doesn't have an option to add an ASMX file
In the Web application project, or the WinForms project? I assume you mean that you cannot add a Web Reference from within your WinForms project; adding an .asmx file to the WinForms project is not necessary. The Web application project should have the .asmx file, which is called by the WinForms project using a web reference.
In the WinForms project you can consume a web service by right-clicking References in the Solution Explorer, then choosing Add Service Reference... (in Visual Studio 2008; other versions may say Add Web Reference...). Then just enter the web address (which may be local in your case, e.g. localhost/foo.asmx) of the web service (.asmx).
See the section "To call an XML Web service synchronously" in this MSDN article: Calling XML Web Services from Windows Forms.
As an alternative, this MS KB article shows how to use the WSDL tool to generate a class that can consume a *.asmx URL. (The article uses VB, but you can switch the parameter to CS to generate C#.)
Update
To add an .asmx file to your Web project, right-click the project in Visual Studio, select Add -> New Item... -> Web Service. If there is not a "Web Service" item any where in the template browser dialog that comes up, then you are missing the template or you're looking in the wrong place.

Resources