Author Archives: Code Monkey

SharePoint 2010?? ?? ID? ???? ?? SPMigrateUsers ??

?? ?? ???: 2012? 6? 3? ???

SharePoint? ??? ? ?? ID? ????? ??? ????. SAML ???? ???? ??? ???? ?? ?????. ? ???? ???? ?? ID ????? ?? ?? ??? ??????. ? ??? a) ???? ????? ?? ?? ??? ?? b) ???? ???? ?? ?? ??? ??? ? ?? ?????. ??? ????? ?? ?? ??? ???? ??? ???? ?? ??? ?? ??? ??? ????. ?? ?? ??? ???? ??? ???? ?? ?? ??? ??????. ??? ??? ????? ?? ???? ?? ???, ?? ?? ?? ??? ???? ?? ??? ????. ??? ??? ??? ??? ???? ??? ?? ???, ? ?????? SharePoint? ?? ??? ?? ?? ??? ???? ??? ????? ?????.

??? ??? ???? ? ??? ???? ??? ??? IMigrateUserCallback ?????? ?? ???? ??? ???? http://blogs.msdn.com/b/sharepoint_ko/archive/2011/03/08/windows-saml.aspx? ???? ????. ? ?????? ?? ?????? ???? ID? ???????? ???, Windows ??? ID? SAML ??? ID? ???? ??? ??? ??? ? ????. ???? ??? Windows ?? ????? ???? ?? ??? ??? ??, ?? ?? ??? ?? ?????? ???? ????? ? ?????. ? ?? ????? ??? ??? ???? ?? ??? ??? ??? ???? ?? ?????, ?? ?? ??(? ???? ???? ??)? ?? ???? ???? ??????? ??? ???? ???? ?? ?? ??? ???? ?? ? ? ???? ??? ???? ??? ??? ? ????.

? ??? ? ?? ??? ?? ??? ?? ????? ??? ? ??? ????. ?, ?? ?? ??? ???? ? ??? ? ?? ? ??? ?? ??? ???? ?? ??? ? ????. ???, ?? ??? ??? ????? ?? ???? SID? ???? ???(?: SAML? ?? ???). ?? ??? ??? SID? ??? ???? ?????. ???? ??? a) ?? ??? ??? ??? ?? ??, b) ?? SID ??? ???? SharePoint ??? SID ??? ???? ???? ?? ???(?? ??? ???? ???? ? ?? ??? ???? ???? ??? ????.), c) SID? ?? Active Directory ????? ??? ??? ????. Azure, Google, Yahoo, Facebook ?? ???? ?? ???? ???? SID? ??? ????.

?? ??? ? ??? ?? ??? ?? ???? ??? ? ??? ????? ????. Windows ??? SMAL ?? ????? ??? ?? ??, SAML ID ???? FBA ?? ???? ??? ?? ???, FBA ??? AD ???? ??? ?? ????. ?? ??? ????? ?? ? ??? ?? ?? ?? “???”? “??”? ?? ?? ??? ??? ? ?? ????? ?? ??? ????? ???????.

?? ??? ???? ??? ? ????. ??? ??? ?? ????.

? ?? ????? ???? ???? ?? ? ?? ????? ??? ?????. ?? ?? ? ? ?? ????? ?? ???? ?? ?? ? ?? ?? ? ?? ?????? ???? ?? ?? ???? ??? ?????. SAML ??? ?? FBA ???? ?? ?? ?? ? ???? ???? ??? ?????. ??? ?????? ?? ???? ?? ???? ???? ???. ??? ?(Claim Value) ???? ?????? ?? ? ? ?? ?? ?????. ?? ??? ?(Plain Text Value) ?? ??? ?? ???? ??? ID ???(ID Claim) ??? ???? ?? ???(Group Claim) ??? ?????. ? ??? ?? ?? ??? ???? ??? ???? ???, ??? ???? ?? ?? ID ???? ?? ???? ?????.

?? ?? SAML ??? ???? ?? ?? ?? “[email protected]”? “[email protected]”?? ????????? ??? ??? ?????. ?? ? ?? ????? ???? ? ?????? SAML ?? ???? ????? ?????. ?? ?? ?? ?(Before Values) ??? ?? ??? ?(Plain Text Value) ?? ??? “[email protected]”? ???? ID ???(ID Claim) ??? ?????. ??? ???? ???? ??? ?? ???? ?(Encoded Value) ?? ??? ?????. ???? ?? ?(After Values) ??? ?? ??? ?(Plain Text Value) ?? ??? “[email protected]”? ?????. ?? ID ???(ID Claim) ??? ?? ???? ??? ?? ???? ?(Encoded Value) ?? ??? ?????.(??: ?? ???? ?? ?(After Values) ??? ???? “ID ???(ID Claim)”? ?? “???(User)”? ???? ???, ?? ????? SAML ????? Windows ????? ???????? ?????.) ?? ?? ???? ??????(Migrate) ??? ???? ????? ?????. ??????? ???? ??? ??? ??? ??? ?????.

?? ? ?? ???? ? ?? ??? ?? ??????? ????? ???? ? ?? ??? ?????? ??? ???? ???????. ??, ?? ? ?? ????? ?? ???? ??????? ? ??? ?? ?? ???? ???????. ? ??? ??? ??? ??? ?? ????? ?? ? ?? ????? ??? ?????? ???? ?? ????, ??? ?? ? ?? ???? 4~5?? ?? ??????? ???? ?? ?? ????? ??????? ?? ????? ? ?? ?????.

???, ??????? ????? ?????? ???? ?????? ??????? ???? ???? ?? ?? ??? ?????. ? ??? ??? ??? ?? ?????? ?? ??? IMigrateUserCallback ??? ?? ???? ???? ???????. ?, ? ??? ?? ????? ?? ??? ??? SharePoint ??? ?????. ??? ??? ???? ???? ?? ??? Visual Studio? ???? ???? ???? ??? ?????? ?? ??? ?????? ???? ?? ????. ? ???? FBA ?? ??? ????? ??? ??????.

?????, ? ?? ??? ??????? ? ? ???? ?????? ??? ??? ?? ?? ???? ?? ?? ??? ???? ??? ????. ?????? ??? ?? ??? ?????. ?? ??? ??? ???? ???? ??? ???? ?????? ??? ????? ?? ??? ?? ??? ??? ?? ??? ???? ?????.

???? ???? ??????. ???? ??? ???? ???. ?? ???? ???, ?? ?? ??? ??? ???? ???? ???? ????? ?? ???? ???? ????? ????.

? ??? ??? ??? ??????. ?? ??? The SPMigrateUsers Tool for Changing Account Identities in SharePoint 2010? ??????.

<!—D;-A;-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[There are times in SharePoint when you want or need to change an account identity.  The best example is with SAML claims.  In virtually of my examples I use email address as the identity claim for users.  I do this because a) most people have an email address and b) an email address is something that most users understand.  However, I get push back every now and then about using email address because people can change it.  When you change your email address, then obviously all the permissions you have would break.  To be honest, I don’t consider this to be a frequent scenario, or I wouldn’t use email address to begin with.  However I will grant you that it does occasionally happen, so what do you do when all of your SharePoint is secured with email addresses?]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[The key to controlling this is in a blog post I did previously on the IMigrateUserCallback interface:  http://blogs.technet.com/b/speschka/archive/2011/01/27/migrating-2D;user-2D;accounts-2D;from-2D;windows-2D;claims-2D;to-2D;saml-2D;claims.aspx.  In that post I describe how to migrate identities using this interface and provided an example of how to convert a Windows claims identity to a SAML claims identity.  What I decided to do is just write a little Windows application that will let you enter the credentials that you want to change and it will make the modification for you.  It’s goal in life is to be used as a simple one-2D;off tool for making these changes, however you could easily take the source code (which I’m including with this post) and modify it to do something more creative, such as reading in a list of users from a file or database and doing the comparisons yourself.]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[What’s also nice about this tool though is that it can actually be used for multiple scenarios.  So not only can you use it to convert from one email address to another, you can also use it to convert from one group name to another.  This is another case where certain Ops folks tell me, hey, you should use SIDs for the group names (i.e. Role claims in SAML) because if you rename the group the SID remains the same.  While that’s also true, again, a) I don’t see that happen a ton, b) how many of you want to start typing in group SID names and adding them to SharePoint groups (please seek therapy now if you answer yes) and c) SIDs mean nothing outside of your local Active Directory – as soon as you move into a cloud-2D;based service like Azure, Google, Yahoo, Facebook, etc. your SID will be as useless as [fill in your own “useless as a …” joke here]5D;.]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[The other thing that’s nice about this tool is that it doesn’t restrict you to just making changes within a single type of provider.  Want to change a Windows group to a SAML role claim?  You can do that.  Want to change a SAML identity claim to an FBA membership user?  You can do that.  Want to change an FBA role to an AD group?  You can do that.  You get the idea – I’ve tried just about every combination of different “users” and “groups” between different providers and so far all have converted back and forth successfully.]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[The tool itself is hopefully pretty straightforward to use; here’s a picture of it:]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[When the application first starts up it loads up a list of all the web applications.  For each web application it populates the two combo boxes below it with a list of all the providers being used on that web application.  If you have multiple SAML providers or multiple FBA providers, each one will be listed in the drop down.  You simply choose which provider you are migrating from and which you are migrating to.  In the Claim Value section you type in the value that want to migrate, and what you want to migrate it to.  Just type the value in the Plain Text Value edit fields and click either the identity claim button (the one on the left) or the group claim button (the one on the right).  The description in the text gives a full explanation of this and the text on the buttons changes so it makes more sense depending on which identity provider you are using.]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[For example, suppose you are only using SAML authentication and wanted to migrate the email address “[email protected]” to “[email protected]”.  You would pick your web application and the SAML authentication provider would be selected by default in each drop down.  Then in the Before Values section you would type “[email protected]” in the Plain Text Value edit and click the ID Claim button; that puts the correct encoded claim value in the Encoded Value edit.  Next you would type “[email protected]” in the After Values Plain Text Value edit.  Click on the ID Claim button again it puts the correct value in the Encoded Value edit box (NOTE:  In the picture above the button in the After Values section says “User” instead of “ID Claim” because in that example it is migrating from SAML claims to Windows claims).  Once all of your values have been provided just click the Migrate button to complete the process; a message box will appear informing you when the migration is complete.]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[In the process of testing this across several different web applications and several different authentication types I did run across a couple of issues that I want to raise here in case you see them as well.  In one case I got an Access Denied error message when trying to migrate the users for one particular web application.  I never was able to track down why this was occurring so the best I can say is that something is wonky in that web app, but I’m not sure what because it worked on all the four or five other web apps I tried in my farm.]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[The second thing is that in one case the migration said it completed successfully but I could not log in as the migrated user.  In digging into it further I found that the account I was migrating from was not being pushed through the IMigrateUserCallback function (i.e. it’s a SharePoint problem, not a coding problem with this application).  If that happens to you I recommend using the source code and Visual Studio to step through the debugger to make sure the account you’re migrating from is getting called.  Unfortunately I had one lonely FBA membership user that got stuck alone in the wilderness.]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[Finally one last thing to note – don’t freak out if you migrate an account from one value to another, then log in as the new user and see the old account name, etc. in the welcome control in the top right corner of the page.  The migrate function just changes the account name.  If the other user information changes at all then as long as you update the user profiles the correct information should get pushed down to all the site collections on the next sync with the profile system.]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[That’s it – have it and hope it helps.  As I said above the complete source code is included so feel free to play with it and modify as needed for your scenario.]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[This is a localized blog post. Please find the original article at The SPMigrateUsers Tool for Changing Account Identities in SharePoint 2010]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A;–>

SharePoint 2010?? SAML ??? ?? ? ???? "?? ???? ??? ? ?? ???? ????." ???

?? ?? ???: 2012? 5? 18? ???

SharePoint??? ??? ???? ?? ??? ???? ??? ????.

???? ??? ?? ?? ?????. ?? ? ??? Nidhish? ?? SharePoint ????? SAML? ????? ?? ??? ????. ??? ?????? ???? ???? ? ? ?? HTTP 500 ??? ???????. ?? ? ?? ? ?? ?? ??????. ??? ??? ??? ???? ?? ULS ??? ?? ”?? ???? ??? ? ?? ???? ????.”?? ??? ???????. ????? SharePoint?? SAML? ??? ??? ??? ??? ???? ???? ????? ??? ?????. ??? ??? ?? SPTrustedRootAuthority? ??? ???? ????, ??? ??? ????, ADFS?? ???? ?? ????, ???? ??? ???? ? ?? ??? ??? ?????. ? ?? ??? ??? ?? ?? ??? ??? ?????? ??? ?? ??? ?? ?????.

?? ADFS? ?? ?? ??? ??? ?? ????? ??, ???? “??” ??? ???????. ?? ???? WS-FED ??? “https://foo/_trust“? ?? “https://foo“? ?? ???? ??? ????. ?? ???? ?????? ??? _trust ????? ?? ??? ?????? ?????. WS-Fed ??? ?????? ?? ??? ????? ??????. ?? ??? ??? ?? ????? ????.

? ??? ??? ??? ??????. ?? ??? The Issuer of a Token is not a Trusted Issuer Craziness with SAML Claims in SharePoint 2010? ??????.

<!—D;-A;-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[Let's be honest -2D; every now and then SharePoint lies to us.]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[Case in point -2D; I was working with my friend Nidhish today, getting SAML working on a SharePoint site.  We started out be getting a strange HTTP 500 error when we hit the site.  That in and of itself is unusual in my experience.  So to try and understand the issue better we cracked open the ULS logs and found this error:  "The issuer of the token is not a trusted issuer."  Now having set up SAML in SharePoint approximately 3,492,234 times, I was fairly confident that we had configured the certificates correctly.  Nonetheless, we then spent a fair amount of time looking at the certificates we had registered with the SPTrustedRootAuthority, comparing certificate thumbprints, double-2D;checking the certificates in ADFS, recycling services and boxes etc.  Just made absolutely no sense at all because every aspect of the certificate configuration appeared to be correct.]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[Finally I decided to review all of the relying party settings in ADFS again, and that's where I found the "real" problem.  Turns out the WS-2D;Fed endpoint for the relying party was mistakenly set to "https://foo", instead of "https://foo/_trust".  All the certificates were in fact correct, but the request was getting redirected to the root instead of the _trust directory.  Once the WS-2D;Fed endpoint was updated everything began working.  Just a little nugget that you may find helpful sometime.]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[This is a localized blog post. Please find the original article at The Issuer of a Token is not a Trusted Issuer Craziness with SAML Claims in SharePoint 2010]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A;–>

?????????? WebMatrix 2 RC: ????????? Node.js, Jade, EJS, LESS, CoffeeScript ? ?????? ??????

????? ?????????? ??????? ???????? ??????????, ??????? WebMatrix ???? ??????????? ????? ?????? WebMatrix 2 Release Candidate. WebMatrix 2 ???????? ? ???? ????? ????? ????? ???????, ?? ??????? ? ????????? ??? ???????????? ? ??????? ??? ??????, ??????? ???? ????????? ??? ????????? ?????????? ?????????? Node.js ? WebMatrix. ??? ???? ????? ????????? WebMatrix 2 ?????????? ??????? ?? ????????? ?????? . ????????? ? ????????????? ? WebMatrix 2 ?????????? ??????????????? ?????? ????? ????????? ????? . ???…(read more)

SAML-Forderungen und Ungereimtheiten mit "Der Aussteller des Tokens ist kein vertrauenswürdiger Aussteller" in SharePoint 2010

Veröffentlichung des Originalartikels: 18.05.2012

Offen gesagt ist SharePoint ab und zu nicht ehrlich zu uns.

So habe ich beispielsweise heute mit meinem Freund Nidhish daran gearbeitet, SAML in einer SharePoint-Website ans Laufen zu kriegen.  Zunächst erhielten wir einen seltsamen HTTP 500-Fehler beim Aufrufen der Website.  Dies ist meiner Erfahrung nach an sich bereits ungewöhnlich.  Zum besseren Verständnis des Problems öffneten wir die ULS-Protokolle und fanden diesen Fehler:  “Der Aussteller des Tokens ist kein vertrauenswürdiger Aussteller”.  Nachdem ich SAML in SharePoint so ungefähr 3.492.234 Mal eingerichtet habe, war ich mir ziemlich sicher, dass die Zertifikate richtig konfiguriert waren.  Nichtsdestotrotz haben wir uns die Zertifikate, die mithilfe von SPTrustedRootAuthority registriert wurden, ziemlich lange angesehen, die Fingerabdrücke der Zertifikate verglichen, die Zertifikate in ADFS gegengeprüft und Dienste und Felder wiederverwendet usw.  Es schien überhaupt keinen Sinn zu ergeben, da jeder Aspekt der Zertifikatkonfiguration scheinbar richtig war.

Schließlich entschloss ich mich, alle Einstellungen der vertrauenden Seite in ADFS erneut zu überprüfen, wobei ich dann auf das “echte” Problem gestoßen bin.  Es stellte sich heraus, dass der WS-Verbund-Endpunkt der vertrauenden Seite fälschlicherweise auf “https://foo” und nicht auf “https://foo/_trust” festgelegt war.  Alle Zertifikate waren tatsächlich richtig, doch wurde die Anforderung an den Stamm anstatt an das Verzeichnis _trust umgeleitet.  Nach dem Aktualisieren des WS-Verbund-Endpunkts funktionierte alles bestens.  Vielleicht erweist sich dieser kleine Tipp ja bei Gelegenheit als hilfreich.

Es handelt sich hierbei um einen übersetzten Blogbeitrag. Sie finden den Originalartikel unter The Issuer of a Token is not a Trusted Issuer Craziness with SAML Claims in SharePoint 2010

<!—D;-A;-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[Let's be honest -2D; every now and then SharePoint lies to us.]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[Case in point -2D; I was working with my friend Nidhish today, getting SAML working on a SharePoint site.  We started out be getting a strange HTTP 500 error when we hit the site.  That in and of itself is unusual in my experience.  So to try and understand the issue better we cracked open the ULS logs and found this error:  "The issuer of the token is not a trusted issuer."  Now having set up SAML in SharePoint approximately 3,492,234 times, I was fairly confident that we had configured the certificates correctly.  Nonetheless, we then spent a fair amount of time looking at the certificates we had registered with the SPTrustedRootAuthority, comparing certificate thumbprints, double-2D;checking the certificates in ADFS, recycling services and boxes etc.  Just made absolutely no sense at all because every aspect of the certificate configuration appeared to be correct.]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[Finally I decided to review all of the relying party settings in ADFS again, and that's where I found the "real" problem.  Turns out the WS-2D;Fed endpoint for the relying party was mistakenly set to "https://foo", instead of "https://foo/_trust".  All the certificates were in fact correct, but the request was getting redirected to the root instead of the _trust directory.  Once the WS-2D;Fed endpoint was updated everything began working.  Just a little nugget that you may find helpful sometime.]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A; <![CDATA[This is a localized blog post. Please find the original article at The Issuer of a Token is not a Trusted Issuer Craziness with SAML Claims in SharePoint 2010]]>-D;-A; -D;-A; -D;-A; -D;-A; -D;-A; -D;-A;–>

SQL Azure Internals

SQL Azure, la propuesta de base de datos relacional como servicio que ofrece Microsoft desde Windows Azure tiene varias diferencias con las implementaciones convencionales de SQL Server, a pesar de que para los usuarios finales el uso es prácticamente el mismo.

Veremos en este video post, realmente cómo está compuesto SQL Azure. En dónde realmente se almacenan nuestras bases de datos. Cuál es el respaldo que ofrece SQL Azure a nuestra información. Cómo se logra un 99.9% de disponibilidad en bases de datos en la nube. Por qué Microsoft no nos cobra los logs, por qué el máximo tamaño de una DB por el momento es de 150GB, cuáles son las configuraciones de hardware de un servidor SQL Azure y muchas otras dudas que seguro hemos tenido alrededor de este tema.

 

Office 365 partner training

Office 365 logoMicrosoft partners in Australia have access to a wide range of training and development programmes. Most of our product training for different roles (eg sales teams, deployment specialists etc) is available online, so that you can complete the training when and wherever you want.

Here’s some of the ones that I’d highlight as critical for our Education partners:

As an example of what the courses contain, here’s a look at the Office 365 Learning Path, which contains an Introduction, and then two different paths for selling and implementing Office 365:

Office 365 Partner Learning Path

If you’re in a Microsoft Education partner, then this training will give you key information to help you in providing the right guidance and support for your customers before, during and after their decision making. It is for Office 365 generally, rather than being specific to Office 365 for Education, which is due for launch soon (and there will be more specific training for that too, which I’ll post here)

You will need to login to the Microsoft Partner Network (MPN) to get access to the courses – using your Windows Live ID. If it’s your first time using the MPN, you’ll also need to associate your ID with your organisation, so that we have the info on which partner you belong to. It’s easy to do, if you start here

Serviço .NET Travando Intermitentemente

Uma vez trabalhei em um caso onde um serviço intermitentemente parava de atender as requisições do System.Runtime.Remoting sem gerar nenhum log de erro.

O erro ocorria no ambiente de produção e a primeira ação tomada foi coletar um dump  no momento do travamento.

Existem várias formas e cenários para coletar um dump. Nesse caso específico, o dump pode ser coletado através do gerenciador de tarefas do Windows. Na aba Processos do Gerenciador de Tarefas, localize o processo do serviço e clique em Create a dump file (ou criar arquivo de despejo).

Utilizamos o WinDbg para abrir e analisar o dump. O  WinDbg é um User mode e Kernel mode debugger com uma interface gráfica que usa a infraestrutura dos debuggers NTSD, CDB e KD para prover um ambiente mais parecido com o Visual Studio, com janelas de watch, breakpoints visuais em linhas de código e outras facilidades, por exemplo, exibir variáveis (incluindo objetos C++), stack traces e memória.

Também utilizamos a extensão Psscor2 do WinDbg criada para ajudar no diagnóstico de problemas de alto consumo de memória, alto consumo de processamento, chashes, hangs e outros problemas que podem ocorrer em aplicações do Framework .Net, para as versões 2.0, 3.0 e 3.5.

Comandos Executados

.load psscor2

Esse comando é executado para carregar a extensão de depuração de código gerenciado Psscor2 que é utilizada para ajudar no diagnóstico de problemas em aplicações do Framework .Net, para as versões 2.0, 3.0 e 3.5.

!threads

Esse comando é utilizado para obter as informações de cada thread gerenciada do sistema incluindo a última exceção que foi gerada pela thread. O objetivo da execução desse comando é verificar quais eram as threads que estavam sendo executadas e se haviam exceções geradas pelas threads, conforme exibido a seguir:

Através do resultado acima é possível observar uma quantidade elevada de threads sendo executada (4007) e uma quantidade elevada de threads (4005) aguardando enfileirada.

 

!eestack –ee

Através desse commando é possível obter o call stack de todas as threads gerenciadas do processo. Ao analisar a pilha dessas threads é possível identificar que a maioria das 4000 threads estavam executando o método  SerializeToDisk da classe RefDataCacheController, conforme exibido a seguir:

  !threadpool

 Esse comando é utilizado para exibir o estado do thread pool durante o momento em que o dump foi coletado. Através desse identificamos que a quantidade de threads utilizadas pela aplicação atingiu o valor máximo do limite disponível no ThreadPool, conforme exibido a seguir:

 

Além de todas threads do thread pool estarem ocupadas, havia uma fila de 36522 work items para serem executados pelo thread pool. Uma vez  que o remoting utiliza o thread pool para atender as requisições remotas,  o serviço não para de atender as requisições de remoting.

Através da execução dos comandos citados anteriormente foi possível identificar que o processo estava consumindo todas as threads disponíveis no thread pool e que essas threads executavam o método  SerializeToDisk da classe RefDataCacheController.

Ao analisar o código-fonte da aplicação identificamos que esse método é executado a cada segundo através de um Timer (System.Threading.Timer) definido no construtor dessa classe. Nesse método existe um código responsável por desativar o timer visando garantir que apenas uma thread seja executada ao mesmo tempo e que não haja enfileiramento, conforme destacado no fragmento de código a seguir:

O fato da função responsável por desativar o timer ser executado dentro do lock (bloco responsável por garantir que apenas uma thread execute ao mesmo tempo) possibilita que mais de uma thread seja executada simultaneamente quando, por exemplo, houver uma demora na execução das duas funções que são executadas antes desse bloco.  O intervalo de um segundo do timer mais o atraso na execução dessas funções permite que a primeira thread habilite o timer justamente após o momento em que a segunda thread desativa o mesmo.

É importante ressaltar que a classe System.Threading.Timer é thread safe, dessa forma, suas operações não precisam ser sincronizadas podendo ser removida dentro do lock.

A equipe de desenvolvimento foi alertada para rever a periodicidade ao qual o timer deve ser executado e alterar o método SerializeToDisk para que o método responsável por desativar a thread seja o primeiro a ser executado.

Serviço .NET Travando Intermitentemente

Uma vez trabalhei em um caso onde um serviço intermitentemente parava de atender as requisições do System.Runtime.Remoting sem gerar nenhum log de erro.

O erro ocorria no ambiente de produção e a primeira ação tomada foi coletar um dump  no momento do travamento.

Existem várias formas e cenários para coletar um dump. Nesse caso específico, o dump pode ser coletado através do gerenciador de tarefas do Windows. Na aba Processos do Gerenciador de Tarefas, localize o processo do serviço e clique em Create a dump file (ou criar arquivo de despejo).

Utilizamos o WinDbg para abrir e analisar o dump. O  WinDbg é um User mode e Kernel mode debugger com uma interface gráfica que usa a infraestrutura dos debuggers NTSD, CDB e KD para prover um ambiente mais parecido com o Visual Studio, com janelas de watch, breakpoints visuais em linhas de código e outras facilidades, por exemplo, exibir variáveis (incluindo objetos C++), stack traces e memória.

Também utilizamos a extensão Psscor2 do WinDbg criada para ajudar no diagnóstico de problemas de alto consumo de memória, alto consumo de processamento, chashes, hangs e outros problemas que podem ocorrer em aplicações do Framework .Net, para as versões 2.0, 3.0 e 3.5.

Comandos Executados

.load psscor2

Esse comando é executado para carregar a extensão de depuração de código gerenciado Psscor2 que é utilizada para ajudar no diagnóstico de problemas em aplicações do Framework .Net, para as versões 2.0, 3.0 e 3.5.

!threads

Esse comando é utilizado para obter as informações de cada thread gerenciada do sistema incluindo a última exceção que foi gerada pela thread. O objetivo da execução desse comando é verificar quais eram as threads que estavam sendo executadas e se haviam exceções geradas pelas threads, conforme exibido a seguir:

Através do resultado acima é possível observar uma quantidade elevada de threads sendo executada (4007) e uma quantidade elevada de threads (4005) aguardando enfileirada.

 

!eestack –ee

Através desse commando é possível obter o call stack de todas as threads gerenciadas do processo. Ao analisar a pilha dessas threads é possível identificar que a maioria das 4000 threads estavam executando o método  SerializeToDisk da classe RefDataCacheController, conforme exibido a seguir:

  !threadpool

 Esse comando é utilizado para exibir o estado do thread pool durante o momento em que o dump foi coletado. Através desse identificamos que a quantidade de threads utilizadas pela aplicação atingiu o valor máximo do limite disponível no ThreadPool, conforme exibido a seguir:

 

Além de todas threads do thread pool estarem ocupadas, havia uma fila de 36522 work items para serem executados pelo thread pool. Uma vez  que o remoting utiliza o thread pool para atender as requisições remotas,  o serviço não para de atender as requisições de remoting.

Através da execução dos comandos citados anteriormente foi possível identificar que o processo estava consumindo todas as threads disponíveis no thread pool e que essas threads executavam o método  SerializeToDisk da classe RefDataCacheController.

Ao analisar o código-fonte da aplicação identificamos que esse método é executado a cada segundo através de um Timer (System.Threading.Timer) definido no construtor dessa classe. Nesse método existe um código responsável por desativar o timer visando garantir que apenas uma thread seja executada ao mesmo tempo e que não haja enfileiramento, conforme destacado no fragmento de código a seguir:

O fato da função responsável por desativar o timer ser executado dentro do lock (bloco responsável por garantir que apenas uma thread execute ao mesmo tempo) possibilita que mais de uma thread seja executada simultaneamente quando, por exemplo, houver uma demora na execução das duas funções que são executadas antes desse bloco.  O intervalo de um segundo do timer mais o atraso na execução dessas funções permite que a primeira thread habilite o timer justamente após o momento em que a segunda thread desativa o mesmo.

É importante ressaltar que a classe System.Threading.Timer é thread safe, dessa forma, suas operações não precisam ser sincronizadas podendo ser removida dentro do lock.

A equipe de desenvolvimento foi alertada para rever a periodicidade ao qual o timer deve ser executado e alterar o método SerializeToDisk para que o método responsável por desativar a thread seja o primeiro a ser executado.

Microsoft TechEd Europe 2012, 25th–29th June 2012 – Sold out

image

With thousands of people expected at the Amsterdam RAI from tomorrow including delegates, speakers and staff, partners and press and analysts TechEd Europe 2012, has SOLD OUT.

Getting to the Amsterdam RAI

TechEd Europe is taking place at the Amsterdam RAI.  The closest station is the Amsterdam RAI station.  From the city center, you can take metro line 51, direction Amstelveen Westwijk, which takes ~15 minutes.  Tram 4 starts at Amsterdam Central station and connects a big part of the city center with Amsterdam RAI.  Tram 4 stops in front of the convention center.

Get the Latest Event Announcements & Share Your Experiences

Get the latest event news and announcements via our Twitter account: http://twitter.com/teched_europe.  Use #TEE12 to tag your tweets and share your experience with other attendees, followers and the TechEd Europe event team. And finally, the TechEd team will be  sharing the event photos on Facebook, but we’d also love to see yours! 

Share your photos by uploading to your Flickr account and tagging with “TEE12”.

Looking forward to meeting all the all the UK academic attendees in Amsterdam and for anyone else attending have a fantastic week in Amsterdam!

A low cost humidity sensor for my sprinkler system

I’ve developed my own sprinkler system which embed a web server and allow me to control it remotely where ever I am. I can program when and how long I will sprinkler on which circuit. I have 3 circuits but my system can work with a large number of circuits.

What I want to do is to be able to add intelligence into my netduino board. This .NET Microframework (NETMF) board runs without any OS. So now Windows, no Linux, no Mac, nothing! Directly .NET on the chip. Not a full .NET of course but all what is necessary to be able to pilot IO, have a web server, etc. All this in an embedded board smallest of the size of a credit card.

Part of my project is to be able to measure the soil humidity. So I’ve decided to develop my own sensor. The basic idea is to measure the conductivity (or resistor) of the soil. Any object/material has it’s own resistance. The more conductive it is, the smallest the resistor is and the less conductive, the higher the resistor is. And it does apply to anything. Metals are usually excellent resistors with a very low resistance of less than 1 ?. And something like a plastic will have more than 1 M? resistor. So if you apply a huge voltage, you’ll get a very small current.

The rule you have to know to do some electronic is U = R x I where U is the voltage (tension in volt V), R is the resistor (in ohm ?) and I is the intensity of the current (in ampere, A). So I will measure the resistor ‘of the soil and I will determine if it is dry or humid.

Let start wit a bit of theory there regarding soil conductivity. It is possible to measure the soil conductivity with a Tellurometer. Soil conductivity is measured by this specific sensor and the resistance of the soil is determined. In my case what will interest me is to be able to measure the difference of conductivity between a humid and a dry soil at the same place. It just need to have 2 stick of copper or any other metal put into the soil and have a current going thru one stick and measuring the difference of voltage from the other.

When a soil is humid the resistor decrease and when it is dry, it does increase. So imagine I will build something like a voltmeter put into the soil and I will measure the resistance. As my netduino has an analogic input I will use it for this purpose. What I measure here, is a voltage so indirectly this variance or resistance. As per the light sensor, I’ll use the same principle:

image

So I will measure the voltage of R3. R3 is a high value of 10K to do a pull down. It is a high resistor which will create a small current between the ground and A0. If I don’t put any resistor,I won’t be able to measure any intensity. And if I place A0 on the ogher side of my sensor and remove R3, I will use more current than in this design. It is possible to do the same as for the light sensor but in my case it will be a bit less efficient I guess.

R1 is here to reduce a bit the current and I will have to adjust this value regarding of my current soil.

The code is extremely simple:

SecretLabs.NETMF.Hardware.AnalogInput SoilSensor = new SecretLabs.NETMF.Hardware.AnalogInput(Pins.GPIO_PIN_A0);
//lightSensor.SetRange(0, 100);

int lSoilSensorReading = 0;
while (true)
{
    SoilSensorReading = SoilSensor.Read();
    Debug.Print(SoilSensorReading.ToString());
    Thread.Sleep(500);
}

I create an analogic input on port A0. And then I read the value every 500 milliseconds. And that’s it!

I’ve done the test with real soil, one is very humid, one a bit humid and one is very dry.

I get the following results:

  • very humid = 650
  • a bit humid = 630
  • very dry = 550

And here is the picture of the prototype:

WP_000792 

As the analogic port has 1024 values going from 0 to 1023 on 3.3V, I have an amplitude of 100 values which represent a variance of approximately 0.32V.

So with this prototype I have a difference of 0.32V between dry and very humid with this specific soil.

I’m sure I can change a bit the sensitivity to use a broader range of the analogic input. I can do like for the light sensor an remove the R3 resistor and measure directly the tension between the sensor and the ground. I can also change R1 to a value close to the middle of the resistance of the soil. I can also change the alimentation value to 5V or so.

That was just a first experiment! Just to prove it is working Sourire Now, I need to improve a bit the system and see how far I can go. Any feedback from an electronic guy welcome.