How to connect a database server running on local machine as a service to web application hosted on pivotal cloud foundry? - asp.net

I am trying to test run a basic .NET web application on pivotal cloud foundry. This web application uses as its database a MongoDB server hosted on my local machine. At the moment I am limited to use of the cloud infrastructure by using just the Apps Manager.
I have read the pivotal cloud foundry docs about user provided services, but cannot figure out as to how the connection is to be really made. I have already come across various other ways like using MongoDB as a service (beta version), but at the moment I am not allowed access to the Operations Manager. Looking for an explanation on user provided services or how to implement the service broker API, specifically.
I am new to Mongo as well, so any suggestion regarding making a connection through tweaking Mongo may help as well. Thanks

The use case you describe (web app in PCF connecting to a resource in your local machine) is not recommended.
You can create a MongoDB instance for development purposes in PCF.
$ cf marketplace
...
mlab sandbox Fully managed MongoDB-as-a-Service
...
You can create a mlab service and bind it to your application. You will then have a MongoDB instance in PCF that you can use for development purposes.
Edit:
In that case a user provided service might help you, where you pass in your remote MongoDB instance configuration that you can read in your application. e.g.:
cf.exe cups my-mongodb -p '{"key1":"value1","key2":"value2"}'

You can add your local mongo-db as a CUPS service to your PCF Dev.
Check out the following post.
How to create a CUPS service for mongoDB?

Related

Post to Azure Cosmos Db from NiFi

I created Azure CosmosDb database and container for my documents.
I use NiFi as a main data ingestion tool and want to feed my container with documents from NiFi flow files.
Can anybody please share a way to post flowfile content to Azure Cosmos Db from NiFi?
Thanks in advance
UPDATE(2019.05.26):
In the end I used Python script and called it from NiFi to post messages. I passed a message as a parameter. The reason I chose python is because it has some examples on official Microsoft site with all the required connection settings and libraries, so it was easy to connect to Cosmos.
I tried Mongo component, but couldn't connect to Azure (security config didn't work), didn't really go too far with it as Python script worked just fine.
Azure CosmosDB exposes MongoDB API so you can use the following MongoDB processors which are available in NiFi to read/query/write to & from Azure CosmosDB using Apache NiFi.
DeleteMongo
GetMongo
PutMongo
PutMongoRecord
RunMonogAggregation
Useful Links
https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb-introduction
https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb-feature-support
Valeria. According to the components list supported by Apache Nifi related to Azure, you could only get Azure Blob Storage, Queue Storage, Event Hub etc,not including Cosmos DB.
So,I suggest you using PutAzureBlobStorage to feed azure blob container with documents from NiFi flow files. Then please create a copy activity pipeline in Azure Data Factory to transfer data from Azure Blob Storage into Azure Cosmos DB.

Azure CosmosDB Firewall for Azure Web Apps

I have an Azure Web App hosting an API (ASP.NET MVC project) that interacts with a CosmosDB database and collections to get subscriptions and other information.
The CosmosDB database is accessed R/W by the Web App middle-ware uses through the nuget package "Microsoft.Azure.DocumentDB" SDK v1.19.1.
I am trying to set up the CosmosDB IP Firewall through the Azure Portal. I allowed the Azure Portal to have access to the db and then I needed to also allow the web app (also hosted on Azure) to have access. To do this, I copied the Virtual IP Address of the Web App from the Properties tab in the Azure Portal.
But this was not enough. I waited more than 10 minutes trying my web app but all the calls to the CosmosDB were rejected with error 404, which as the documentation states it is the proper behavior for SDK Calls (security reasons).
Then I added, all the Outbound IP Addresses stated at the same Properties Tab of the Web App. Waited for more than 20 mins and still 404 error.
What are the correct steps to achieve the requested task?
For example in SQL On Azure, the IP Filtering allowed for an option, to allow access from any Azure App/ VM / Service. How can we achieve the equivalent in CosmosDB?
Thanks in advance
Since Azure App Service is PaaS, and following this article, please try adding the IP 0.0.0.0.
On the Azure Portal, this can also be set by switching on Allow access to Azure Services.

SignalR performance counters in Azure Web App

I've been trying to load test SignalR on my Azure Web App service (E.g. how many connections it can handle before subscribe calls to the hub start failing). I found that SignalR perfomance counters (https://www.asp.net/signalr/overview/performance/signalr-performance ) can provide me such info. However, I cannot install those performance counters on Web App service, buy running
SignalR.exe ipc
Is there a way to install those performance counters on WebApp or retrieve them somehow from code?
Performance Counters can't be installed on Azure Web App, as it is provided as a managed container and not a full fledged IIS on which you can do everything.
To be able to use these performance counters you can redeploy your solution on an Azure VM or to a Cloud Service, keeping in mind you will loose the flexibility that Azure Web App offers.
You can expose the SignalR performance counters in an Azure Web App using a WebRole, as stated in this article

What is the host url of Oracle cloud Application Express?

I have signed up for the trial version of oracle cloud data base.
Where can I find the host URL that I need to use in my Java dynamic web project of eclipse?
Thanks in advance.
Basic knowledge about the trial request and details needed :
After you request a trial service from Oracle Cloud, you'll be provided with a few details: Identity Domain, Temporary password, and your username.
By using them you'll login to your trial cloud account from here:
[https://cloud.oracle.com/sign_in][1]
Accessing the service from Eclipse
When it comes to access your Database Cloud Service from Eclipse:
You need to add the Oracle Cloud plugin from the Eclipse Market (Help Menu->Eclipse Marketplace)
You'll add the Oracle Cloud connection window to the interface (Window Menu->Show View->Other)
Create a new connection where you follow the steps with the proper details you have about your account.

Best way to handle a local SQL server communication with a cloud SQL server? (.NET Web App)

I have a .NET web-app (4.5) the app is a cloud app in the sense that it is hosted remotely and has its own local SQL data source.
The web app needs to talk to client SQL servers (in this case lets say my local SQL database). At the core the web app will request data from the remote SQL source and save it to the local SQL source, or the other way around the web-app may notify the remote SQL source that it needs to update a particular record, etc.
What would be the best way to do this?
I was looking at just doing a windows service on the client SQL server, and the web app makes calls to the client SQL box web service telling it what it needs to update or send over?
I started looking into WCF would this be a good application of WCF?
You may want to consider implementing an OData service as a WCF Data Service hosted in IIS that exposes data queried from SQL Server.
The following MSDN article provides an overview of a SQL Server OData implementation:
http://msdn.microsoft.com/en-us/data/gg192995.aspx
The following CodePlex link seems to provide good and relevant information pertaining to your scenario:
http://msftdbprodsamples.codeplex.com/releases/view/101644
Regards,

Resources