This post is also available in English

Ofis makinemi de Windows 7'ye güncelledikten sonra daha eğlenceli hatalar alacağımdan şüphem yoktu. Bütün kurulumlar (updateler yüzünden) tam bir gün sürdü. Makineme hep kurduğum Visual Studio 2003-2005-2008 üçlemesinden ilkini kurarken, artık bu Windows 7'nin (ve Vista'nın) VS2003 desteklemediğini öğrendim. Öneriler çok yaratıcıydı: "Virtual PC'de Windows XP kullanın". Şimdilik VS2003 ihtiyacı olan projelerime bakmıyor olmamın sevinciyle bir VS2005 projesi denedim. İlk güzel hatayı aldım:

HTTP Error 500.23 - Internal Server Error: An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode.



Kısa bir araştırma sonrasında, 2005 projeleri için ekrandaki öneriyi uygulamanın bir problem yaratmayacağını öğrendim:


  1. IIS 7.5 Açılır

  2. Sites/Default Web Site dalı genişletilir

  3. Sorunlu Application'a sağ tıklanıp "Manage Application/Advanced Settings..." seçilir

  4. Açılan kutuda "Application Pool" "Classic .NET AppPool" olarak değiştirilip kaydedilir


Bu sorunu çözmenin yaşattığı mutluluk ile hemen bir VS2008 projesi açtım, compile etmeye çalıştım, "Temporary ASP.NET Files" dizini altında bir yerlere erişim problemi olduğu ile ilgili bir hata aldım. Gittim dizine aklıma gelen bütün kullanıcılara yetki verdim. Bu sefer de projenin DLL'lerinden birine ulaşılamadığı hatasını aldım:



Bu noktadan sonra bir "Temporary ASP.NET Files" dizini yetki hatası bir DLL erişim yetki hatası arasında döndüm durdum. Yetki verme denemeleri ve düzeltme uğraşım, iki güne bölünen yaklaşık 4-5 saatlik bir süreç boyunca devam etti. Tarayıcıda alınan hata da benzer bir hataydı:



Oldukça uzun bir internet araştırması sonucunda bulduğum çözüm insanı ağlatacak cinstendi. Windows altındaki Microsoft .NET dizinine "Users" grubu için "Special Permission" vermek bütün sorunu bir anda ortadan kaldırdı.

Bu Windows 7 - Visual Studio ekürisi ile çok eğlenceli günler bizleri bekliyor gibi...

I'm nearly-fully satisfied with the Windows 7, that I began to use at home nowadays. To be honest, I can say that I'm an addict of it because of performance.

Or "was". Until it took 1 hour and 40 minutes to make a website working on IIS.

I didn't expected it to be so smooth but I never guessed a bloody ending like this. I created my site as usual and wanted to see the empty page immediately. When I came by IIS 7.5 and see the jelly-candy interface, I felt that things will not do good. Anyway I defined the website and went to the browser and firs error:

ERROR 1: HTTP Error 500.19 / Error Code: 0x80070005 / Config Error: Cannot read configuration file due to insufficient permissions

Inspection phase began of course. It was obvious that this is an access problem. I permitted the IIS_IUSRS user to access web project folder. I Refreshed the page in browser and second error:

ERROR 2: HTTP Error 500.19 / Error Code: 0x80070021 / Config Error: This configuration section cannot be used at this path. This happens when the section is locked at parent level....

This was the most educating error in this story. Though the things I've learnt was not related with the error... After some research, I've found out an easy way.
Opening the file at location %windir%\system32\inetsrv\config\applicationhost.config and to change the "Deny" words into "Allow" in this portion:

<section name="handlers" overrideModeDefault="Deny" />
<section name="modules" allowDefinition="MachineToApplication" overrideModeDefault="Deny" />
By this way, I will be allowing sections to be overwritten in web.config.
It's an easy thing to do but if you can find the file... I immediately switched to my Total Commander, navigated to path, and what? directory is empty? look around it's empty? Then I switched to cmd. Navigated to path, nothing.
Then I learned the thing "SYSWOW32 Redirection" from a forum. In 64Bit operating systems, there are two system folders. One System32 and one SysWOW64. But because all software will try to access to system folder in same way, Microsoft redirects 32bit applications to 32Bit system folder by "SYSWOW32 Redirection". This means if you use an 32bit application to view the folder (Total Commander and cmd in my case) the folder shows empty, because the folder is not actually that folder.
After I got this, I switched to 64bit Notepad and managed to open and change the file by pointing to it with full path. Returned to browser, refreshed and here comes the 3rd error:

ERROR 3: HTTP Error 401.3 / Error Code: 0x80070005 / Unauthorized


After a long research, I found out that the problem is related with site authentication in IIS 7.5. It's needed to follow these steps in order to correct it:
1. Go to IIS7.5,
2. Expand "Sites" node, click the problem web site's name.
3. Double click "Authentication" on the right.
4. Right click on "Anonymous Authentication" item and click "Edit...".
5. Check the "Application Pool Identity" option
6. Save it.
I've completed all steps, returned to browser expecting "it's ok this time", F5 andddd


ERROR 4: HTTP Error 404.3 / Error Code: 0x80070032 / Not Found

I thought that ASp.NET handler is not working but how to find and correct in this jelly-candy IIS7.5? I began searching for it this time. I found out where the handlers are but no one was knowing about ASP.NET handlers over there. I then learned that requires manual activation of ASP.NET components even if you have Framework installed. For this, we go to "Programs and Features" from Control Panel and then say "Turn Windows Features on or off". Then in the appearing tree, we go to this node: "Internet Information Services/World Wide Web Services/Application Development Features". Then we pick all items here except "CGI".

After completing these steps, I've refreshed browser then an error more. But this time I began to get good-old yellow error pages of ASP.NET. It was a meaningless error but I tried to compile project once more. Then it healed and lastly I managed to see my white good and empty Default.asp page...

These issues are not lived on an operating system installation that is screwed up and is living for ages. Operating system was 3-4 days old and Visual Studio installation was just 1 days old. In other words, platform was nearly out-of-the-box.

I hope this story heals somebody's problems out there...

Bu yazının Türkçe sürümü bulunmaktadır

While re-profiling our company's backup strategy, we've needed a piece of software to use while copying files between servers and to our local system using FTP w/o interaction and preferably using command line paremeters. No promising solutions were available on the internet. Because this was a real "must" for us that we can not give up, I've decided to build the tool "FTP Push" that will fullfill our needs.

You can find the tool at http://ali.inal.info/FTPPush/FTPPush.zip. Because the tool is built with C# on .NET Framework 3.5, you need to have this Framework installation first. While fulfilling our needs, I've tried to build a more flexible tool in order to make it work in other similar cases for different users.

Here is some of the features:
* Because no user interaction is needed and is runnable through command line, you can set the tool as scheduled task and automate your jobs.
* By passing different setting files as parameter to tool, you can plan different profiled FTP uploads.
* Ports other than 21 are also supported so you may configure your firewall as needed.
* You can define unlimited number of folders in a setting file so all folders will be uploaded sequentially.
* You redirect different folders to different (or same) folders on target FTP sites. Folders will be created automatically in case of need.
* File search patterns can be defined on folders.
* Optionally, you can set the tool to recurse subfolders of upload folders.
* Upon completion of the upload procedure, an upload log report can be delivered to predefined admin list via e-mail.
* You can set mailing server settings and also perform SMTP Authentication.

Tool is using a setting file (like below) that can either be passed to tool as command line parameter or saved next to executable file as "settings.xml":

<?xml version="1.0"?>
<FTPInfo>
<server address="ftp://ftp.yourdomain.com" port="21">
<credentials>
<UserName>ftppush.user</UserName>
<Password>ftppush.password</Password>
<Domain />
</credentials>
</server>
<folders>
<folder localPath="d:\Backups\PSTs" remotePath="PSTs" filter="*.pst" recurse="true" />
<folder localPath="d:\Backups\DBs" remotePath="DBs" filter="*.mdb;*.mdf;*.accdb" recurse="true" />
</folders>
<mailing server="smtp.yourdomain.com" port="35" subject="FTP Push Status Info">
<authenticateAs>
<UserName>sender@yourdomain.com</UserName>
<Password>password</Password>
<Domain />
</authenticateAs>
<fromName>FTP Push Service</fromName>
<fromEmail>sender@yourdomain.com</fromEmail>
<admins>
<admin>admin1@yourdomain.com</admin>
<admin>admin2@yourdomain.com</admin>
</admins>
</mailing>
</FTPInfo>


You're able to set all features mentioned above using this XML file. Then just simply save this file next to exe file named as "settings.xml" or save it with another name and pass this name to exe file as command line parameter. By this way, you'll be able to automate different upload task with just one exe file.

You can download and test the tool from http://ali.inal.info/FTPPush/FTPPush.zip. This tool will always be freeware. I'm open to all requests and suggestions, I'll try to improve the tool as I find time.

I hope this tool also works for others...



Bu yazının Türkçe sürümü bulunmaktadır

This post is also available in English

Şirketimin yedeklerini sunucular arasında ve yerel disklerimize çekmek için, kullanıcı etkileşimi olmadan (tercihen komut satırından) çalışabilecek bir FTP gönderim uygulamasına ihtiyaç duyduk. İnternet üzerindeki aramalarda çok iç açıcı çözümlere ulaşamadık. Bu bizim için önemli ve vazgeçemeyeceğimiz bir ihtiyaç olduğu için bu işi görecek bir uygulama geliştirmeye karar verdim ve komut satırından çalışan "FTP Push" uygulamasını geliştirdim.

Uygulamaya http://ali.inal.info/FTPPush/FTPPush.zip adresinden erişebilirsiniz. Uygulama, C# dili ile .NET Framework 3.5 kullanılarak geliştirildiği için öncelikle bu Framework'ün kurulu olması gerekiyor. Bizim ihtiyaçlarımızı karşılayacak bir uygulama geliştirirken bazı özellikleri de geniş tutarak bu konuda sıkıntı çeken başkalarının ihtiyaçlarını da karşılayabilmeyi düşündüm.

Desteklenen bazı özellikler şöyle:
* Komut satırından çalıştırılabildiği ve kullanıcı etkileşimi gerektirmediği için sisteminizde zamanlı görev olarak kurabilir, çalışmalarınızı otomize edebilirsiniz.
* Farklı ayar dosyalarını parametre olarak geçirerel farklı profildeki FTP yüklemelerini planlayabilirsiniz.
* 21 haricindeki portları da desteklediği için firewall sorunlarının önüne geçebilirsiniz.
* Tek bir görev dosyasının içerisinde sınırsız sayıda dizin belirtip, sırayla hepsinin yüklenmesini sağlayabilirsiniz.
* Her bir dizin yüklemesini, FTP sunucusu üzerindeki farklı dizinlere yönlendirebilirsiniz.
* Yüklenecek kaynak dizinler üzerinde dosya filtresi uygulayabilirsiniz.
* Belirttiğiniz dizinlerin alt dizinlerinin de yüklenmesini (opsiyonel olarak) sağlayabilirsiniz.
* Upload işlemi tamamlandığında, tanımladığınız admin adreslerine yükleme raporunun e-posta aracılığı ile gönderilmesini sağlayabilirsiniz.
* E-posta sunucusu ayarlarını değiştirebilir, SMTP Authentication yapabilirsiniz.

Uygulama, komut satırından parametre olarak geçirebileceğiniz veya uygulama dizinine settings.xml adıyla kaydedebileceğiniz, aşağıdaki yapıya sahip XML dosyasını ayar dosyası olarak kabul ediyor:

<?xml version="1.0"?>
<FTPInfo>
<server address="ftp://ftp.yourdomain.com" port="21">
<credentials>
<UserName>ftppush.user</UserName>
<Password>ftppush.password</Password>
<Domain />
</credentials>
</server>
<folders>
<folder localPath="d:\Backups\PSTs" remotePath="PSTs" filter="*.pst" recurse="true" />
<folder localPath="d:\Backups\DBs" remotePath="DBs" filter="*.mdb;*.mdf;*.accdb" recurse="true" />
</folders>
<mailing server="smtp.yourdomain.com" port="35" subject="FTP Push Status Info">
<authenticateAs>
<UserName>sender@yourdomain.com</UserName>
<Password>password</Password>
<Domain />
</authenticateAs>
<fromName>FTP Push Service</fromName>
<fromEmail>sender@yourdomain.com</fromEmail>
<admins>
<admin>admin1@yourdomain.com</admin>
<admin>admin2@yourdomain.com</admin>
</admins>
</mailing>
</FTPInfo>

Yukarıda bahsettiğim özelliklerin tamamını bu XML dosyası ile ayarlamanız mümkün. Bu XML dosyasını, exe dosyasının yanına settings.xml olarak kaydetmeniz yeterli. Veya farklı bir isimle kaydedip, exe dosyasına parametre olarak dosya adını geçirirseniz, bu xml dosyası ayar dosyası olarak kullanılacaktır. Bu sayede farklı ayarlarınızı aynı exe ile otomize etmeniz mümkün olacaktır.

Programı http://ali.inal.info/FTPPush/FTPPush.zip adresinden indirip, deneyebilirsiniz. Yazılımı tamamen freeware olarak tutacağım. Öneri ve isteklere açığım, elim deydiğince uygulamayı geliştirmeyi deneyeceğim.

Umarım benden başka birilerinin de işine yarar...

Özellikle eski bir SQL Server kurulumunuzu yenilemeniz gerekiyorsa, zamanında ayarladığınız SQL Agent Job'ların parametrelerini hatırlamak bir bela olabilir. Eğer elinizde msdb (MSDBData.mdf, MSDBLog.ldf) veritabanınızın yedeği varsa hiç korkmayın, bütün bu bilgileri sorgulayabilirsiniz.


Öncelikle yedeğinizdeki msdb veritabanını, farklı bir isimle yeni kurulumunuza attach edin (örneğin msdb2). Yeni kurulumunuzun da aynı isimli bir sistem veritabanı olacağı için bu ismi kullanmanıza izin olmayacaktır çünkü. Daha sonra aşağıdaki basit join ile, job, job step'leri ve schedule'ları ile ilgili bütün bilgileri çekebilirsiniz:

SELECT * FROM
[msdb2].[dbo].[sysjobs] J INNER JOIN
[msdb2].[dbo].[sysjobsteps] S on J.job_id=S.job_id INNER JOIN
[msdb2].[dbo].[sysjobschedules] X on S.job_id = X.job_id

Mevcut sisteminizdeki job'larla ilgili bilgi almak isterseniz de msdb2 veritabanı adını msdb olarak değiştirmeniz yeterli olacaktır. Sorgudan da görebileceğiniz üzere, bilgiler "sysjobs" ibaresi ile başlayan bir seri tabloda tutulmakta.
Daha fazla bilgi almak isterseniz ek olarak sysjobactivity, sysjobhistory, sysjobservers, sysjobstpeslogs tablolarına da göz atmanızı tavsiye ederim...

Tesadüfen Javascript ile yazılmış bir Commodore 64 emülatörü ve QBASIC compiler'ı gördükten sonra iyiden yaşlanmaya başladığımı anladım. İlk göz ağrılarım artık scripting dilleri ile bile gerçeklenebilecek kadar teknoloji dışı kalmış :)


Javascript C64: http://bit.ly/8oacuG
Javascript C64 (2): http://bit.ly/4JVAnL (Yazılımcı tam olmadığını belirtmiş)
Flash (ECMAScript) C64: http://bit.ly/7tpBMJ

Javascript QBASIC Compiler: http://bit.ly/7rbkl0

Commodore 64 ile en az 5-6 sene, QBASIC ile de en az 6-7 sene geçirdiğimi düşünürseniz niye yaşlanmış hissedip, nostalji yaşadığımı anlarsınız :)

SQL Server 2005 Reporting Services'da yakın zamanda başıma gelen bir sorunu ve çözümünü paylaşmak istedim. Kullandığınız Table nesnesinde, hücrelerin alt padding değerlerini kullanarak satır aralarını açıyorsanız, tablonun sayfa sonunda ortadan bölünmesi durumunda arada bir satırı kaybetme riski ile karşı karşıyasınız demektir. Bu sorunun sadece PDF çıktısında olduğunu da belirtmek isterim. Sorunun sebebi, padding olan satırlarda, PDF export modülünün satır yüksekliklerini yanlış hesaplamasından dolayı satırın footer altında kalması. Aslında satır kaybolmuyor, fakat footer altında kaldığı için görünmüyor.


Sorunun çözümü ise oldukça basit. Satırlar arasında boşluk bırakmak istiyorsanız, tekrar eden satır grubuna bir satır daha ekleyin ve bunun yüksekliğini değiştirin. Eğer satır aralığını programatik olarak değiştirmek istiyorsanız, yine bu boş satırdaki hücrelerin alt sınır padding değerleri ile oynayarak bunu da sağlayabilirsiniz.

Bu çözümde aslında hata olmasını engellemiş olmuyoruz. Hata olduğunda, kaybolma riski olan satır bir data satırı değil boş bir satır olmuş oluyor. Bu sayede çıktıda bir sorun yaşanmamış oluyor.

Copyright Ali INAL ©2009 - Creative Commons Licence
preload preload preload

Taşındık!


Ali's Surprisingly Web blog'u, artık yeni, güçlü ve daha esnek altyapısıyla yeni adresinden yayın yapıyor. Yeni adresimiz: http://surprisingly.web.tr. Bu eski blog sayfalarındaki bütün içerik, yeni blog altyapısına da taşındı. Arzu ederseniz sizi yeni blog'umda ağırlamak isterim.
Yeni blog'a gitmek istiyorum Bu sayfayı okumak istiyorum

We've Moved!


Ali's Surprisingly Web Blog is now serving from a new, stronger and flexible system with a brand new address. Our new address: http://surprisingly.web.tr. Also we've migrated all old content from this blog to our new blog. If you wish, I want to welcome yo to my new blog.
I want to visit new blog I want to stay and read this page