Posts

Showing posts from March, 2013

Configuring SMTP Server in Azure Role

http://community.adxstudio.com/products/adxstudio-portals/developers-guide/azure/dynamically-install-an-smtp-server-in-windows-azur/ The article is great, you just don't need to put in an end point on port 25 unless you want to make calls on that port to send emails. It works fine even without it, if your app living on the instance is making SMTP calls to send emails.

Gated check-ins in TFS are great!

I think any team with distributed team members and/ or lot of people need gated check-ins otherwise the build keeps breaking all the time. There is a problem I found which happened after the TFS Update 2. If you do a gated checkin for the same file several times a day, even though you are the only person working on the file and you are working from a single machine, it finds conflicts during a subsequent check-in and forces you to merge changes. Looks like a bug to me.

Faster way to check for blob existence

http://chopapp.com/#y5frcmsb The above will not work for private containers, hence I have updated the code: http://chopapp.com/#fkgs5j3u

Trying to update Azure deployment from the portal?

It really behaves weird. First it does not work, and gives weird error messages and the IE 10 + Azure new portal locks the package preventing visual studio from overwriting it. Error 98 Unable to remove directory "bin\Debug\app.publish\". The directory is not empty. C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets 4220 5 XYZ Took me sometime to figure out it was the browser locking the file. It kept telling me some setting is different in the upgrade vs what is already deployed. Anyway, I kept trying again and again, and Visual Studio finally deleted the deployment and rebuilt it again. I closed IE 10 and opened it again. I figured out that when I deploy from VS 2012, profiling is turned on. So, I turned it off. Now, it does update whatever role I want to update without complaining. You may need to do the same for example - updating all roles except the dedicated caching roles.

Creating not settable properties for API use

This is an easy way to do it, without using non default constructors and such: [ Serializable ]     [ DataContract ]      public   class   MyClass     {                          [ DataMember ]          public   int ? MyProperty1 {  get ;  internal   set ; }                  [ DataMember ]          public   int ? MyProperty2 {  get ;  internal   set ; }     } In previous articles, I have mentioned why you should always mark DataContract and DataMember attributes even though it is not explicitly required anymore. For your assembly where you set the property to be able to access the set, in this assembly use the below attribute: [ assembly :  InternalsVisibleTo ( "MyOtherAssembly, PublicKey=MyPublicKeyLongString" )] Btb, the XmlSerializer will not work when the sets are internal. To serialize as XML use the DataContractSerializer which is faster and better: public   static   string  SerializeToXml( object  input)         {              MemoryStream  ms = 

ASP.NET page weirdly redirecting to home page or not loading at all for no reason

If you have read my previous post on pointing your custom domain name to an azure domain via CNAME record and how to fix the MX records for emails, we modified the @ entry for the custom domain from: @          xyz.cloudapp.net                             CNAME to @          http://www.customdomain.com    URL Redirect (301) www     xyz.cloudapp.net                              CNAME There is a problem with this. For some reason, if my links are http://customdomain.com/folder/1.aspx?id=123 It does not work. Neither over SSL nor over HTTP. To get this to work, I had to change my link to: http:// www. customdomain.com/folder/1.aspx?id=123 I am not really sure why this is necessary, and why neither Google Chrome or IE 10 is able to handle it. I'll keep you posted if I hear from namecheap guys.

Getting an Azure Web Role to work with SSL, and then with ACS with real SSL certificate

It took me a week and some hosting provider change to get my Azure stuff working the way I wanted it to work. I am going to try and mention everything here so it is easy for the next person. Just note, whatever I have not mentioned, there are plenty of examples online, and they work, but you need the below thing in addition to those articles to really get it to work. 1. Discountasp.net sucks. Because the basic thing you need to get your cloud app working is a CNAME record from your domain name to the cloud provider domain (x.cloudapp.net for azure). These guys don't support it and their support people will give you really bad ideas which will break your site links and none of which will work. So, I am currently using NameCheap DNS where this is supported and whose Awesome support team went above and beyond to fix other issues which I will mention here. " At this point you have two choices: 1. You can use the solution provided below; or 2. You can use a third party

Setting the trace level for windows azure logging

It can be confusing to determine how you can set your default trace logging level to in windows azure. You have to set it like this, so the system can understand that all the stuff you are writing to the log is actually going as log level 2, which is warning. Otherwise, if you use caching (say) too many log lines to make sense of it all. http://msdn.microsoft.com/en-us/library/system.diagnostics.tracelevel.aspx <system.diagnostics>     <switches>       <add name="logLevel" value="2" />     </switches>     <trace>       <listeners>         <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">           <filter type="" />         </add>       </listeners>     </trace>   </system.diagnostics> In additi

Redirect from https login page to http page loses session

This is because a round trip to the client is needed to save the cookie. To get around this, from the login page redirect to another https page, and from there redirect to an http page - then session is not lost.

Windows Azure: The certificate's private key could not be accessed.

<WebRole name="XYZ" vmsize="ExtraSmall" enableNativeCodeExecution="true">     <Runtime executionContext="elevated"></Runtime> The above is the fix for it. If you don;t want to do it, the below can also work: <Certificates>       <Certificate name="XYZ" permissionLevel="limitedOrElevated" storeLocation="LocalMachine" storeName="My" />     </Certificates>

Create certificate for azure web role

http://msdn.microsoft.com/en-us/library/gg432987.aspx

Read and Write to Azure like FTP Client

I have the entire code listing here: http://www.snipsave.com/user/profile/vijaymohan#4410 It will not compile by default.  But you can remove those lines and it takes of everything needed to host your files on the Azure cloud.

Comparing by value, and not by reference

This is a very good post: http://stackoverflow.com/questions/614713/datarow-comparison-not-working-as-expected