Is there any equivalent ServiceDefinition.csdef for publish to an App service? - c#

We are updating a project that uses Azure tools to publish to a cloud service that will instead publish to an App service through Publish in visual studio 2017.
Through the Azure Tools we were able to define in .csdef VirtualApplicaton and VirtualDirectory to map the project as we wanted. But can not find anything to achieve this in order to publish to an app service.
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="Azure.Web.Azure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2015-04.2.6">
<WebRole name="Azure.Web" vmsize="Small">
<Sites>
<Site name="Web">
<VirtualDirectory name="backendprop" physicalDirectory="../../../PropertySystem/backendprop/">
<VirtualApplication name="v1" physicalDirectory="../../../../Published/PropertySystem/Backend/v1/" />
<VirtualApplication name="v1.1" physicalDirectory="../../../../Published/PropertySystem/Backend/v1.1/" />
<VirtualApplication name="v1.2" physicalDirectory="../../../../Published/PropertySystem/Backend/v1.2/" />
</VirtualDirectory>
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
<Imports>
<Import moduleName="RemoteAccess" />
<Import moduleName="RemoteForwarder" />
</Imports>
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
<Setting name="APPINSIGHTS_INSTRUMENTATIONKEY" />
</ConfigurationSettings>
</WebRole>
</ServiceDefinition>
We want to merge from the Published folder that is local and publish them in a new folder under backendprop like ServiceDefeniton.csdef which was used before.

Related

Error with azure project

I have an Azure project in TFS that used to work well.
I've just get the latest version and rebuilt the project and now I have some errors:
Error 97 The setting 'Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel' for role ServiceLayer is specified in the service configuration file, but it is not declared in the service definition file. D:\...\ServiceLayer.Azure1\ServiceConfiguration.Local.cscfg 1 1 ServiceLayer.Azure1
Error 98 Role: 'ServiceLayer', setting 'Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel' in all service configurations could not be found in the service definition. D:\...\ServiceLayer.Azure1\ServiceDefinition.csdef
I have the following code:
ServiceDefinition.csdef:
<ServiceDefinition name="ServiceLayer.Azure1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2014-01.2.3">
<WebRole name="ServiceLayer" vmsize="Medium">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
<Imports>
<Import moduleName="Diagnostics" />
<Import moduleName="RemoteAccess" />
<Import moduleName="RemoteForwarder" />
</Imports>
</WebRole>
</ServiceDefinition>
and the file: ServiceConfiguration.Local.cscfg:
<ServiceConfiguration serviceName="ServiceLayer.Azure1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="3" osVersion="*" schemaVersion="2014-01.2.3">
<Role name="ServiceLayer">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="[...]" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="[...]" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="2015-03-05T23:59:59.0000000+01:00" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled" value="true" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel" value="1" />
</ConfigurationSettings>
<Certificates>
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="A218B66C70E780B00E189FAF7C75B0696B90D284" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>
You need to specify all your setting names (without values) also in the Service definition file in the ConfigurationSettings section.
So your ServiceDefinitionFile should look like:
<ServiceDefinition name="ServiceLayer.Azure1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2014-01.2.3">
<WebRole name="ServiceLayer" vmsize="Medium">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
<Imports>
<Import moduleName="Diagnostics" />
<Import moduleName="RemoteAccess" />
<Import moduleName="RemoteForwarder" />
</Imports>
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" />
.... and so on (all your settings here
</ConfigurationSettings>
</WebRole>
</ServiceDefinition>
EDIT:
The same you need to do for your Certificates section.

Fail to build Azure Cloud Service

I reopened an old project with a wcf cloud service and im getting these errors:
Error 113 The setting 'Microsoft.WindowsAzure.Plugins.Connect.Refresh' for role WCFService is specified in the service configuration file, but it is not declared in the service definition file. C:\Users\Etc\ - Cloud\Cloud Service\ServiceConfiguration.Cloud.cscfg
Error 114 The setting 'Microsoft.WindowsAzure.Plugins.Connect.WaitForConnectivity' for role WCFService is specified in the service configuration file, but it is not declared in the service definition file. C:\Users\Etc\ Service\ServiceConfiguration.Cloud.cscfg
And more 10 errors like this, my ServiceConfiguration file
<Role name="WCFService">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=xxxxx;AccountKey=xxxxxxxxxxxxxx" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.Refresh" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.WaitForConnectivity" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.Upgrade" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.EnableDomainJoin" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.DomainFQDN" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.DomainControllerFQDN" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.DomainAccountName" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.DomainPassword" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.DomainOU" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.Administrators" value="" />
<Setting name="Microsoft.WindowsAzure.Plugins.Connect.DomainSiteName" value="" />
</ConfigurationSettings>
</Role>
<Role name="WorkerRoleService">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=xxxx;AccountKey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
</ConfigurationSettings>
</Role>
</ServiceConfiguration>
And my ServiceDefinition file:
<WebRole name="WCFGuazzelliService" vmsize="ExtraSmall">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
<Imports>
<Import moduleName="Diagnostics" />
<Import moduleName="Connect" />
</Imports>
<LocalResources>
<LocalStorage name="WCFService.svclog" sizeInMB="1000" cleanOnRoleRecycle="false" />
</LocalResources>
</WebRole>
<WorkerRole name="WorkerRoleService" vmsize="ExtraSmall">
<Imports>
<Import moduleName="Diagnostics" />
</Imports>
</WorkerRole>
Any ideas what it could be?
That's configuration that is using Windows Azure Connect which was retired on 3 July 2013.
Details on what to do found in this post: Windows Azure Connect Has Been Retired
If you're not using it, those configuration items (Microsoft.WindowsAzure.Plugins.Connect.Refresh.*) can probably be removed.

Windows Azure In-Role Cache - WARNING: <SimpleSendReceiveModule> DeadServerCallback Called

I have an Azure cloud service app that is comprised of a worker role (1 instance only) and a web role (multiple instances). The web role is also where the Microsoft.WindowsAzure.Caching's (version 2.2) in-role co-located cache cluster resides. I have Azure diagnostics set up and in my WadLogsTable I see this pair of warnings every few minutes in production:
WARNING: DeadServerCallback Called, Server URI: [net.tcp://100.74.158.31:20005], Underlying exception - ; TraceSource 'w3wp.exe' event
WARNING: DeadServerCallback: Matches My Server, Cleaning Pending Requests; TraceSource 'w3wp.exe' event
The net.tcp://100.74.158.31:20005 corresponds to one of the web roles. The warnings sporatically alternate between the web roles (i.e. sometimes it says net.tcp://100.74.158.51:20005).
Notice that there is nothing after "Underlying exception - ". There are also no related exceptions in the WadWindowsEventLogsTable (I know that Azure exception logging is working because I will occasionally see other exceptions in that table). I believe I've also turned on all the Caching diagnostics that I could.
So my issue is that I am seeing all these warnings but I don't know why and I don't know how to remedy the situation. It doesn't appear that these warnings are causing the app to crash, but still they are worrisome. Any help would be appreciated.
Here is my ServiceConfiguration.cscfg:
<?xml version="1.0"?>
<ServiceConfiguration serviceName="CloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="3" osVersion="*" schemaVersion="2013-10.2.2">
<Role name="WebRole">
<Instances count="2" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=XXXXX;AccountKey=XXXXX" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.NamedCaches" value="{"caches":[{"name":"default","policy":{"eviction":{"type":0},"expiration":{"defaultTTL":10,"isExpirable":true,"type":2},"serverNotification":{"isEnabled":false}},"secondaries":0}]}" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.DiagnosticLevel" value="3" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.CacheSizePercentage" value="30" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ConfigStoreConnectionString" value="DefaultEndpointsProtocol=https;AccountName=XXXXX;AccountKey=XXXXX" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel" value="3" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="Me" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="XXXXX" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="2014-08-05T23:59:59.0000000-07:00" />
</ConfigurationSettings>
<Certificates>
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="XXXXX" thumbprintAlgorithm="sha1" />
<Certificate name="www.myapp.com" thumbprint="XXXXX" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
<Role name="WorkerRole">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel" value="3" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="Me" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="XXXXX" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="2014-08-05T23:59:59.0000000-07:00" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled" value="true" />
<!-- For Windows Azure ServiceManagement. -->
<Setting name="SubscriptionId" value="XXXXX" />
<Setting name="ServiceManagementCertificateThumbprint" value="value="XXXXX" " />
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=XXXXX;AccountKey=XXXXX" />
</ConfigurationSettings>
<Certificates>
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="XXXXX" thumbprintAlgorithm="sha1" />
<!-- For Windows Azure ServiceManagement. -->
<Certificate name="ServiceManagementCertificate" thumbprint="thumbprint="XXXXX" " thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>
Here are pertinent parts of the Web.config of my web role:
<dataCacheClients>
<dataCacheClient name="default" connectionPool="true" useLegacyProtocol="false" isCompressionEnabled="false" maxConnectionsToServer="2">
<autoDiscover isEnabled="true" identifier="WebRole" />
</dataCacheClient>
</dataCacheClients>
<cacheDiagnostics>
<crashDump dumpLevel="Full" dumpStorageQuotaInMB="100" scheduledTransferPeriodInMinutes="5" />
</cacheDiagnostics>
Here are pertinent parts of the App.config of my worker role:
<dataCacheClients>
<dataCacheClient name="default" connectionPool="true" useLegacyProtocol="false" isCompressionEnabled="false" maxConnectionsToServer="2">
<autoDiscover isEnabled="true" identifier="WebRole" />
</dataCacheClient>
</dataCacheClients>
<cacheDiagnostics>
<crashDump dumpLevel="Full" dumpStorageQuotaInMB="100" scheduledTransferPeriodInMinutes="5" />
</cacheDiagnostics>
Additional notes:
I've probably tried every possible combination of attribute settings for both the <dataCacheClient> entries in the web role's
Web.config and worker role's App.config.
The cloud service has been upgraded to use Windows Azure Tools version 2.2.
I've Googled and found a few posts related to these warnings but it seems that most people only experienced this in the compute emulator, not on production like I am. Nevertheless, I've tried most of their suggested solutions and nothing has helped.
As long as you dont see any failures or timeouts or drop in quality of the service, you should be good. The deadserver callback should be just cleaning up old unused connections. To validate this hypothesis :
Do you have any other connection errors happening in verbose logging ? Can you see if the last request to this server was a long time back ? Do you have bursty traffic ?

Azure Cloud Service Not Loading in Deployment

I have an ASP.NET app that I am trying to deploy to Azure Cloud. It works locally but not when I deploy it. Below is my Service Definition file. The certificate "cuteanimals" is self assigned and I have already added it in Azure.
The URL is http://cuteanimals.cloudapp.net/
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="ImageSharingWithCloudService" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2013-03.2.0">
<WebRole name="WebRole" vmsize="Small">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="EndpointHTTPS" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="EndpointHTTPS" protocol="https" port="443" certificate="cuteanimals" />
</Endpoints>
<Imports>
<Import moduleName="Diagnostics" />
<Import moduleName="RemoteAccess" />
</Imports>
<Certificates>
<Certificate name="cuteanimals" storeLocation="LocalMachine" storeName="My" />
</Certificates>
</WebRole>
<WorkerRole name="ImageValidation" vmsize="Small">
<Imports>
<Import moduleName="Diagnostics" />
<Import moduleName="RemoteAccess" />
<Import moduleName="RemoteForwarder" />
</Imports>
<ConfigurationSettings>
<Setting name="Microsoft.ServiceBus.ConnectionString" />
</ConfigurationSettings>
<Certificates>
</Certificates>
</WorkerRole>
</ServiceDefinition>
Thank you.
You have only opened https endpoint on your website. I've navigated to https://cuteanimals.cloudapp.net/ and it looks OK
You will want to add another endpoint for port 80

Read azure ServiceConfiguration file's certificate section using c#

Can we read certificate section withi ServiceConfiguration.cscfg file using c#? There is method inside RoleEnvironment class to read ConfigurationSettings, but not certificate section.
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="WindowsAzureProject7" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="1" osVersion="*">
<Role name="MvcWebRole1" >
<Instances count="1" />
<Certificates>
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="625FBBB3B7A25C4B9D1C49D1CB1E3AE196C1A083" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>
Yes, there is no API to read certificate details as far as i know, however what you can do is create a configuration setting and add your certificate specific details and read it directly from the same API. Here is the trick, I used in past:
<ServiceConfiguration serviceName="RW" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration">
<Role name="RR">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="AppFolder" value="RailsApp" />
<Setting name="CertificateThumb" value="*************" />
</ConfigurationSettings>
<Certificates>
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="*****************************" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>
Now, in my role specific code, I can call RoleEnvironment.GetConfigurationSettingValue to get the certificate thumb as below:
string certThumb = RoleEnvironment.GetConfigurationSettingValue("CertificateThumb");

Resources