Archive
The Apache2.2 service terminated with service-specific error 1 (0x1).
It fails to start with "The Apache2.2 service terminated with service-specific error 1 (0x1)." in the event log.
To get around this, edit ApacheConfHttpd.conf
Change Listen 80 to Listen 8080
Then comment out the line #LoadModule ssl_module modules/mod_ssl.so with a hash at the start,
then it starts!
Importing a CSV file into Amazon SimpleDB
Console.WriteLine("Connecting to Amazon Simple DB");
NameValueCollection appConfig = ConfigurationManager.AppSettings;
AmazonSimpleDB sdb = AWSClientFactory.CreateAmazonSimpleDBClient(
appConfig["AWSAccessKey"],
appConfig["AWSSecretKey"]
);
// Setup Flights DataStore
String domainName = "CSV";
CreateDomainRequest createDomain = (new CreateDomainRequest()).WithDomainName(domainName);
sdb.CreateDomain(createDomain);
Console.WriteLine("Created flights DB on Amazon");
string strCSVFile = @"C:MyFile.csv";
FileStream fsCSV = new FileStream(strCSVFile, FileMode.Open, FileAccess.Read);
StreamReader srCSV = new StreamReader(fsCSV);
string strHeaderLine = srCSV.ReadLine();
string[] strHeaders = Regex.Split(strHeaderLine, ",");
// Remove Inverted Commas
for (int i = 0; i < strHeaders.Length; i++)
{
strHeaders[i] = strHeaders[i].Replace(""", "");
}
Console.WriteLine("Read column headers");
string strDataLine = srCSV.ReadLine();
while(!string.IsNullOrEmpty(strDataLine))
{
string[] strData = Regex.Split(strDataLine, ",");
if (strData.Length < strHeaders.Length) continue;
strDataLine = srCSV.ReadLine();
PutAttributesRequest putAttributesAction = new PutAttributesRequest().WithDomainName(domainName).WithItemName(Guid.NewGuid().ToString());
List<ReplaceableAttribute> attributes = putAttributesAction.Attribute;
for (int i = 0; i < strHeaders.Length-1; i++)
{
strData[i] = strData[i].Replace(""", "");
attributes.Add(new ReplaceableAttribute().WithName(strHeaders[i]).WithValue(strData[i]));
}
sdb.PutAttributes(putAttributesAction);
Console.WriteLine(strDataLine);
}
More than one endpoint configuration for that contract was found
some problems with web services that have more than one binding, i.e. designed to support Soap 1.0 and Soap 1.2.
This was the first sign of this nasty quirk;
An endpoint configuration section for contract ‘FreebieSMSWebservice.BulkSMSSoap’ could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name.
If you open the Configuration.svcinfo file, then scroll to the end right, you’ll see the xml (below). Where I’ve highlighted the endpoint names;
So then the client code becomes:
BulkSMSSoapClient SMS = new BulkSMSSoapClient("BulkSMSSoap");
double dCredit = SMS.GetRemainingCredit("xxxx", "xxxx");
MessageBox.Show(dCredit.ToString());
Where the parameter sent to the constructor is the endpoint name.
<?xml version="1.0" encoding="utf-8"?>
<configurationSnapshot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot">
<behaviors />
<bindings>
<binding digest="System.ServiceModel.Configuration.BasicHttpBindingElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:<?xml version="1.0" encoding="utf-16"?><Data hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" messageEncoding="Text" name="BulkSMSSoap" textEncoding="utf-8" transferMode="Buffered"><readerQuotas maxArrayLength="16384" maxBytesPerRead="4096" maxDepth="32" maxNameTableCharCount="16384" maxStringContentLength="8192" /><security mode="None"><message algorithmSuite="Default" clientCredentialType="UserName" /><transport clientCredentialType="None" proxyCredentialType="None" realm="" /></security></Data>" bindingType="basicHttpBinding" name="BulkSMSSoap" />
<binding digest="System.ServiceModel.Configuration.CustomBindingElement, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089:<?xml version="1.0" encoding="utf-16"?><Data name="BulkSMSSoap12"><httpTransport allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" manualAddressing="false" maxBufferPoolSize="524288" maxBufferSize="65536" maxReceivedMessageSize="65536" proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" /><textMessageEncoding maxReadPoolSize="64" maxWritePoolSize="16" messageVersion="Soap12" writeEncoding="utf-8"><readerQuotas maxArrayLength="16384" maxBytesPerRead="4096" maxDepth="32" maxNameTableCharCount="16384" maxStringContentLength="8192" /></textMessageEncoding></Data>" bindingType="customBinding" name="BulkSMSSoap12" />
</bindings>
<endpoints>
<endpoint normalizedDigest="<?xml version="1.0" encoding="utf-16"?><Data address="http://www.freebiesms.co.uk/bulksms.asmx" binding="basicHttpBinding" bindingConfiguration="BulkSMSSoap" contract="FreebieSMSWebservice.BulkSMSSoap" name="BulkSMSSoap" />" digest="<?xml version="1.0" encoding="utf-16"?><Data address="http://www.freebiesms.co.uk/bulksms.asmx" binding="basicHttpBinding" bindingConfiguration="BulkSMSSoap" contract="FreebieSMSWebservice.BulkSMSSoap" name="BulkSMSSoap" />" contractName="FreebieSMSWebservice.BulkSMSSoap" name="BulkSMSSoap" />
<endpoint normalizedDigest="<?xml version="1.0" encoding="utf-16"?><Data address="http://www.freebiesms.co.uk/bulksms.asmx" binding="customBinding" bindingConfiguration="BulkSMSSoap12" contract="FreebieSMSWebservice.BulkSMSSoap" name="BulkSMSSoap12" />" digest="<?xml version="1.0" encoding="utf-16"?><Data address="http://www.freebiesms.co.uk/bulksms.asmx" binding="customBinding" bindingConfiguration="BulkSMSSoap12" contract="FreebieSMSWebservice.BulkSMSSoap" name="BulkSMSSoap12" />" contractName="FreebieSMSWebservice.BulkSMSSoap" name="BulkSMSSoap12" />
</endpoints>
</configurationSnapshot>