publish does not show resource groups - visual-studio-2019

I am trying to publish a project to azure. I want to re-use a web app. But I don't see the parent Resource group eve. Any ideas? Here is a picture:
missing rg

That can be for different reason. but that happen to me was that the Azure web app resources that I created in AZURE was configured with a different NET framework that the application that I was trying to publish. In this case don't see the Web App and also not resource group.
Go to Azure portal and take a look to your WEB APP framework configuration at:
Change it to your use net framework if it is different.

Related

Azure Deploy multiple projects on single web app

I have three different projects, I have to deploy these projects under single web app with different sub domains. I already purchased the custom domain. To deploy these project I have created three directories.
I have also setup the virtual directories in the app settings.
The domains are also set
And I deploy the web part like this.
Now when I'm trying to access the web sub domain its showing me the default azure page
How can I access the projects on the basis of sub domains.
So I got an idea from Nancy comment. So you just have to update the virtual applications and the directories as follows.
Now I can access the web using https://web.example.com/ Thanks #Nancy.

How to publish to azure

I have an mvc application thats built using the repository pattern. My Database resides in the SmokersTavern.Data folder. I have published the site to azure. On startup the user must logon thereof will be redirected to the Products table. However I get the following error.
It is not allowed to connect to local database when your web app has been published to Azure.
You should create an Azure sql database and connect to it instead. Here's the tutorial for you to refer.
You need to create an Azure resource group deployment project with your Visual Studio web application so that Visual Studio knows where to publish your code. Please take a look at this:
Creating and deploying Azure resource groups through Visual Studio
Although, you are using the 'Publish to Azure' feature, I don't see the resource group configuration in the Solution Explorer pane on the right (based upon the screen capture you provided).
Following this document will walk you through the set-up, configuration, and publishing of your web application to Azure.
I created the app service + sql and in my visual studio I connected to app service created on Azure. My connection string in my config file was not that of the Azure sql db

404 error on azure for Asp.Net Web Api Project

I have deployed exact same solution on two servers, one is my own server in my basement and the other one is Microsoft Azure. The project is developed using Asp.Net Web Api 2.
On my own windows server running IIS 8.5 it totally works. For test, you can simply browse this link in your browser and see the error message {"Message":"The requested resource does not support http method 'GET'."} which shows the API has been hit.1
But exact same project on my Azure domain here, you just get a message saying
The resource you are looking for has been removed, had its name
changed, or is temporarily unavailable.
Everything about these two deployments is the same (to the best of my knowledge) and I was wondering if there is any further steps necessary on Web Api app deployment in MS Azure which I am missing.
I finally found the answer to this issue. If there are multiple apps deployed as one single website so each app is located in its own subfolder, you have to go to the configuration section of your web app on Azure and create virtual directories for each of those sub folders.
Ah, my problem was probably a common one. I was using
rootconfig = System.Web.Configuration.WebconfigurationManager.OpenWebConfiguration(null);
and that was returning the root web because the parameter was null.
When I ran it local that worked fine, but after I deployed the root Config was NOT what I wanted and my code was failing.
Switched to direct access via
stringVal = WebconfigurationManager.AppSettings["Foobar"].ToString();
Nice. Plus less overhead.

Azure ASP.NET deploy error

I have a strange issue, when I deploy asp.net mvc app to azure service this error appears:
I have tried to clean my project, create new resource group, new app service plan and nothing helps. In fact, I don't know why this problem appears , I am doing the same actions as I was doing before, when successfully published my apps.
I am deploying my application from visual studio, I was trying to create web app from azure portal but I don't know how to connect my db to this app (I am using entity framework + code first and simple link to my db (in "link resources" tab of my web application settings) doesn't work.
Does some1 faced this problem before? I will be glad for any help.
P.S. Start page of web app works, but I can't connect to db.
Did you use the portal from manage.windowsazure.com or the new one which is portal.azure.com? I would suggest you to create everything (including app service plan, resource group, web app, etc) using the new azure portal because I found some reference that stated those two portal use different API so that's maybe why there are some problem if you use both portal at the same time (I don't know why they use different API). Maybe you can try to recreate everything but using the new portal consistently and let me know the result :)
Based on the error message, the root cause of your deployment issue is due to invalid Api version parameter for the resource group: "Default-SQL-NorthEurope".
The api-version you have specified for the above resource group deployment template is 2.0, which is invalid.
The valid api-version format must be: yyyy-MM-dd
The supported suffixes: "-preview,-alpha,-beta,-rc,-privatepreview"
From the name of your resource group, it should contain Azure Sql database server and database resources.
You should use api-version: 2014-04-01-preview for the resource group above.
Below is the reference for the resource group deployment template for Azure web app and SQL database:
Azure Quickstart template: 201-web-app-sql-database
Hope this helps!

Running Web API and MVC projects simultaneously

So I have two projects: a Web API service and MVC web site which consumes service, both in one solution. I considered to run them using multiple startup projects option, but encountered a problem. Since Web API has no web interface, it opens in browser and lists contents of project directory. How can I prevent this?
If you don't want the browser window to open every time you run the project you can change your Web Api project properties.
Go to Properties > Web and select "Don't open a page. Wait for a request from an external application" under the 'Start Action' heading, this will keep the project running in the background.
See answer here: https://stackoverflow.com/a/716757

Resources