I was trying to deploy an application in AWS elastic beanstalk with connection string inside web.config file everything works fine. But when I tried to implement by setting environment variables in AWS application it did not work. What I did was I added AWS tags key value pair in aws like RDS_DATABASENAME - admin then i added those in web.config like
<add key="RDS_DB_NAME" value="RDS_DB_NAME"/>
<add key="RDS_USERNAME" value="RDS_USERNAME"/>
<add key="RDS_PASSWORD" value="RDS_PASSWORD"/>
<add key="RDS_HOSTNAME" value="RDS_HOSTNAME"/>
<add key="RDS_PORT" value="*RDS_PORT" />
Then while building connectionString I used this:
var appConfig = ConfigurationManager.AppSettings; // trying to get connection details from enviornment varibales
string dbname = appConfig["RDS_DB_NAME"];
if (string.IsNullOrEmpty(dbname)) return null;
string username = appConfig["RDS_USERNAME"];
string password = appConfig["RDS_PASSWORD"];
string hostname = appConfig["RDS_HOSTNAME"];
string port = appConfig["RDS_PORT"];
SqlConnectionStringBuilder sqlString = new SqlConnectionStringBuilder()
{
DataSource = hostname + "," + port,
InitialCatalog = dbname,
UserID = username,
Password = password
};
return sqlString.ToString();
I followed the aws doc itself somehow I missed something!
The idea with Elastic Beanstalk is that any Environment Properties configured for the Environment will be automatically passed to your application. In a .NET application, this means that they are appended automatically to the end of the <appSettings> section of the Web.config.
So you shouldn't need to make any changes to your Web.config (I would leave those variables out entirely), and your implementation of building the connectionString appears fine.
To troubleshoot, try launching the application with the Environment Properties set. Then log into the instance and verify that the variables have been added to the Web.config correctly. If they are you might need to do some more testing around making sure your application is reading them in correctly.
Related
I am trying to configure Superset with multiple ldap servers, but at this moment, I was able to setup for only one server.
Any work around that can be done in the 'Config.py' to configure multiple servers at a same time??
I have given the following configuration in the ‘config.py’ file.
config.py - LDAP configs
AUTH_TYPE = AUTH_LDAP
AUTH_USER_REGISTRATION = True
AUTH_USER_REGISTRATION_ROLE = "Alpha"
AUTH_LDAP_SERVER = "ldap://ldap_example_server_one:389"
AUTH_LDAP_USE_TLS = False
AUTH_LDAP_BIND_USER = "CN=my_user,OU=my_users,DC=my,DC=domain"
AUTH_LDAP_BIND_PASSWORD = "mypassword"
AUTH_LDAP_SEARCH = "DC=my,DC=domain"
AUTH_LDAP_UID_FIELD = "sAMAccountName"
Note – It worked for ‘ldap_example_server_one:389’ server but when tried to add another server it threw an Configuration failure error.
You can't use multiple LDAP servers with default LDAP authenticator from Flask Appbuilder. You have to implement your own custom security manager which will be able to operate as many LDAP servers as you want.
At first, you should create new file, e.g. my_security_manager.py. Put these lines into it:
from superset.security import SupersetSecurityManager
class MySecurityManager(SupersetSecurityManager):
def __init__(self, appbuilder):
super(MySecurityManager, self).__init__(appbuilder)
Secondly, you should let Superset know that you want to use your brand new security manager. To do so, add these lines to your Superset configuration file (superset_config.py):
from my_security_manager import MySecurityManager
CUSTOM_SECURITY_MANAGER = MySecurityManager
Here is additional information on the topic.
When I add the following NuGet package to my WebJob: Microsoft.Azure.WebJobs.ServiceBus 2.0.0,
two new items are added to the app.config file.
It seems they are both used to define the Service Bus connection string.
Can I get rid of one of them?
<connectionStrings>
<add name="AzureWebJobsServiceBus" connectionString="..." />
</connectionStrings>
<appSettings>
<!-- Service Bus specific app setings for messaging connections -->
<add key="Microsoft.ServiceBus.ConnectionString" value="..." />
</appSettings>
Thanks for your help!
It seems they are both used to define the Service Bus connection string. Can I get rid of one of them?
According the source code of ServiceBusConfiguration, WebJob Service Bus SDK(ServiceBusTrigger) will use the connection string which stored under the connectionStrings section.
public string ConnectionString
{
get
{
if (!_connectionStringSet)
{
_connectionString = AmbientConnectionStringProvider.Instance.GetConnectionString(ConnectionStringNames.ServiceBus);
_connectionStringSet = true;
}
return _connectionString;
}
set
{
_connectionString = value;
_connectionStringSet = true;
}
}
You can also set the connection string at runtime.
JobHostConfiguration config = new JobHostConfiguration();
config.UseServiceBus(new ServiceBusConfiguration() { ConnectionString = "" });
JobHost host = new JobHost(config);
If you want to create a instance of Service Bus Client(for example QueueClient) to do some specific operations, you could use the Service Bus connection string configured in appSettings.
//Use CloudConfigurationManager to read the connection string stored in appSettings
string connectionString = CloudConfigurationManager.GetSetting("Microsoft.ServiceBus.ConnectionString");
var client = QueueClient.CreateFromConnectionString(connectionString, "queueName");
I'm trying to implement an interface to AWS' DynamoDB in ColdFusion 11, on a corporate network with an NTLM proxy. I started with BDCraven's cfdynamo implementation, and extended it as per the SDK docs to include my proxy settings.
Component structure and init function below. getProxyParameters.cfm pulls my proxy settings from the database and initialises strProxyServer, strProxyPort etc. These proxy settings and credentials have been tested in other ColdFusion code (using cfhttp) and are definitely valid.
component accessors="true" alias="cfc.DynamoClient" displayname="DynamoClient" hint="I handle interactions with an Amazon DynamoDB instance"{
property name="aws_key" type="string" hint="The AWS Key";
property name="aws_secret" type="string" hint="The AWS Secret";
property name="aws_creds" type="object";
property name="aws_dynamodb" type="object";
include "/getProxyParameters.cfm";
variables.aws_key = "";
variables.aws_secret = "";
public cfc.DynamoClient function init(required string aws_key, required string aws_secret){
variables.aws_key = trim(arguments.aws_key);
variables.aws_secret = trim(arguments.aws_secret);
variables.aws_creds = createObject("java","com.amazonaws.auth.BasicAWSCredentials").init(variables.aws_key, variables.aws_secret);
aws_clientconfig = createObject("java","com.amazonaws.ClientConfiguration").init();
aws_clientconfig.setProtocol(createObject("java","com.amazonaws.Protocol").HTTPS);
aws_clientconfig.setProxyHost(strProxyServer);
aws_clientconfig.setProxyPort(strProxyPort);
aws_clientconfig.setProxyUsername(strProxyUsername);
aws_clientconfig.setProxyPassword(strProxyPassword);
aws_clientconfig.setProxyDomain(strProxyDomain);
variables.aws_dynamodb = createObject("java","com.amazonaws.services.dynamodb.AmazonDynamoDBClient").init(aws_creds, aws_clientconfig);
variables.aws_dynamodb.setEndpoint('dynamodb.ap-southeast-2.amazonaws.com');
variables.aws_dynamodb.setConfiguration(aws_clientconfig);
return this;
}
[...etc]
This init function returns without error, and variables.aws_dynamodb is an object of type com.amazonaws.services.dynamodb.AmazonDynamoDBClient.
The problem is that when I try to use it, the proxy settings are ignored:
public array function list_tables(string start_table, numeric limit=1){
var table_request = createObject("java","com.amazonaws.services.dynamodb.model.ListTablesRequest").init();
table_request.setLimit(arguments.limit);
if(structKeyExists(arguments,"start_table")){
table_request.setExcusiveStartTableName(trim(arguments.start_table));
}
return variables.aws_dynamodb.listTables(table_request).getTableNames();
}
This list_tables function waits for a long time, and then returns a ColdFusion error:
I've tried running netstat -a on the server while this request is happening, and the only connection is this SYN_SENT:
...and that IP looks like one of AWS's servers, not my proxy. Am I missing something obvious? Has anyone gotten this combination of tech to work properly?
I have some issues with an ASMX web service running on Win XP with IIS 5.1. The IIS is set up with Integrated Windows Authentication and with anonymous access disabled. (When I have anonymous access enabled, everything works as a charm.)
However, when I turn of anonymous access and run with only Integrated Windows Authentication on my IIS, I get the following exception:
The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The authentication header received from the server was 'Negotiate,NTLM'.
This exception is generated from my really simple console application that I'm using just to test the concept:
BasicHttpBinding binding = new BasicHttpBinding();
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows; // .None;
binding.UseDefaultWebProxy = false;
EndpointIdentity spn = EndpointIdentity.CreateSpnIdentity("WORKGROUP/VirtualXP-91051");
Uri uri = new Uri("http://169.254.91.91/MyWebSite/MyService.asmx");
EndpointAddress address = new EndpointAddress(uri, spn);
MyServiceSoapClient client = new MyServiceSoapClient(binding, address);
client.ClientCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
String req = "( the request string is blanked out.. ;) )";
string resp = client.ReqAddressData(req);
Console.WriteLine(resp);
Console.ReadLine();
The interesting part of App.config:
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
This isn't rocket science, so I must be missing something obvious. I've done some searching here on SO, and eve though I can find many similar questions I've found nothing that solved my problem.
I'm having serious problems with creating a Web service in Visual Studio 2010 (Framework 4).
Anyway, I have to use a Oracle membership provider (I have installed "Oracle Providers for ASP.NET 4 11.2.0.2.0', which modifies the framework's machine.config), but I can not connect to the membership.
My code in web.config is as follows:
<configuration>
<connectionStrings>
<remove name="OraAspNetConString"></remove>
<add name="OraAspNetConString" connectionString="User Id=USUARIO;Password=PASSWORD;Data Source=DATABASENAME;" providerName="Oracle.DataAcces.Client"/>
</connectionStrings>
<system.web>
<membership defaultProvider="OracleMembershipProvider" userIsOnlineTimeWindow="30"/>
<roleManager defaultProvider="OracleRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="30" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All"/>
<authentication mode="None"/>
<authorization>
<allow users="*"/>
</authorization>
I also added the reference 'System.Web.ApplicationServices' to my project.
To test the connection to the membership of Oracle I have put this code in one of the OperationContract that has my web service:
MembershipUserCollection userC = Membership.GetAllUsers();
sample.StringValue += " - " + userC.Count;
bool resp = Membership.ValidateUser(id, id2);
The obtained MembershipUserCollection always appears without users. UserC.Count always equals zero.
The parameters 'id' and 'id2', username and password respectively, are used to validate (that is a poor use, I know) but always returns false.
Anybody can help me with this?
Thanks a lot.
PD: Authentication mode is 'None', I've tried with 'Forms' and still not working.
Problem solved.
I needed to put the name of the application (applicationName) on the label of the membership and role manager providers (in the file machine.config).
:-)