How to run custom domain name in Azure - asp.net-mvc

I want to run my application through azure project in Visual Studio. But it runs it not as I expected. It runs the project like: http://127.0.0.1:82/ not as I want: http://testproject.com.

If you are running the site on your local machine you can update your Hosts File so that it includes an entry for testproject.com that points to 127.0.0.1 while you're testing. When you're done testing make sure you remove the entry in this file.

Once you push it to the cloud you can use a dns cname to redirect your domain. Here's an article that explains it more http://blog.smarx.com/posts/custom-domain-names-in-windows-azure

Related

Trouble connecting to Docker application via subdirectory instead of port

Preface: I'm new to the whole web hosting thing, so I apologize if any information I give doesn't make sense or is inaccurate. I will do my best to explain things.
I currently have a self-hosted server running Windows Server 2019 that is hosting two sites via IIS. I recently have created an application that runs on a Docker container instance that hosts a website on port 40444. I would like to access this site via a specific subdirectory on my website instead of the port (www.mywebsite.com/website3 instead of www.mywebsite.com:40444). For clarification, here is an example of what I'm looking to do:
www.mywebsite.com/website1 (hosted on IIS)
www.mywebsite.com/website2 (hosted on IIS)
www.mywebsite.com/website3 (hosted on docker via port 40444)
I was able to get a basic reverse proxy set up and successfully got the docker application to show on localhost/, but I would prefer using a subdirectory if possible.(image below).
I attempted to change (.*) to (.*)website3$ and it did what I wanted, but the website cannot load any files (i.e css, js, etc.) and gives me the following error
https://www.mywebsite.com/css/style.css net::ERR_ABORTED 404 (Not Found)
If IIS isn't the best option to accomplish what I need I am more than happy to use a different solution. As I mentioned before, I'm new to web hosting and it was just the simplest to set up.

How to setup a virtual directory for local host test run?

I have an ASP.net MVC 5 aplication with VS2017.
I would like to load some pictures from a network path (the pictures should not be included to the project folder structure).
I know how to add a virtual directory in IIS on my server where the application is finally running. But I dont know how to setup the same on my local computer.
On the server I can setup an Alias and a physical path.
But in my project in VS2017(properties/web) I can only press the button "create virtual directory" next to project url "http://localhost:51138/".
Can maybe someone explain how to setup an virtual directory on localhost for testing? Thank you so much.
You are using the Visual Studio Development Server which does not allow virtual directories. You can do what you want with a local copy of IIS, creating a website that points to your development folder, and creating the virtual directory you want in that website.
Install a local copy of IIS. This is available to you in the
Professional version of Windows.
Open IIS Manager, create a new website, and set the Physical
Path to your development folder.
Add a binding for this website with the Host name set to a domain name you want to use for
testing. I generally use ".loc" as the TLD. For example, the
production website domain of "mywebservice.com" would be
"mywebservice.loc". Use port 80 in the binding.
Modify your local hosts file at
C:\Windows\System32\drivers\etc\hosts to include this line. Replace
"mywebservice.loc" with whatever domain you chose to use above mywebservice.loc 127.0.0.1
In your VS project properties, set Web-->Servers to Use Custom Web Server and
set the Server Url to mywebservice.loc or whatever domain you chose above.
Now you can add a virtual directory just as you do in production.
I do this for all my website development primarily because nothing will happen in production that does not happen locally. You can even test using real SSL certificates this way.
Just create a folder in the directory of your project to mimic what will be a virtual directory and then copy some test files there.
For example, create a documents directory in your project directory. So the referenced path in your project will be something like ~/documents/somefile.pdf
The server's virtual directory documents can then point to some some other network location.

why after deploying mvc app to azure tables not created?

I use code first and the app works well on a local database which was generated.
But when I deploy to Azure, although it succeeds, the tables are not created, just the empty database.
I excluded the local app_data folder and chose to run code first migrations
in the deployment options.
Any tips what's wrong?
Have you configured Azure deployment to replace connection strings (via the publishing wizard) or are you using environmental variables in your code? It doesn't sound like it. It sounds like you deployed with localdb which does not work in Azure.
You need to either (there are more options, but these are easy to implement):
Configure your deployment process to update your web.config with your SQL Azure connection string (you can use config transformations or deplyment wizard)
Use Azure environmental variables to be used automatically when running in Azure and local variables when locally

how to create virtual host for rails application?

I have two rails application. one is crowd sourcing platform from github
I put this on my server. now it runs on my local server. I have another domain. And want to put this crowd sourcing platform in my domain. How to do that and how to make virtual host for that?
Thanks , Zeel
You could try deploying it to heroku
https://devcenter.heroku.com/articles/rails3

How to deploy a rails app with no domain name. (trying to create a test server)

Ok so what i'm trying to do is deploy my first rails project. I've asked this question and i think i figured out that you can't configure apache to work using an ip and you have to have a domain name.
The reason i can't use the domain name yet is because i'm recreating a site for someone and they don't want it to be down in between switching the domain from their current site to their new rails site.
I'd like to get my rails app running on a server so I can test it out and then once it's ready, switch the domain name.
How can i setup a server to run a rails project without using the domain name?
If you want to run the rails project locally in development mode, then just run the command rails s from the root of your project.
It is possible to deploy two apps to the same server, or two versions of the same app, I typically use sub-domains for this, website.com and then testing.website.com.
You will just need to have seperate databases and seperate virtualhost files.
You could also try to access the apache machine by it's IP address if it is on the local network.

Resources