mercoledì 8 giugno 2011

Unable to open module file 'C:\Users\[UserName]\AppData\Local \Temp\.NETFramework,Version=v4.0,Profile=Client.AssemblyAttributes.vb': File missing

Unable to open module file 'C:\Users\[UserName]\AppData\Local \Temp\.NETFramework,Version=v4.0,Profile=Client.AssemblyAttributes.vb': File missing

I don't know the exact cause of this strange compiler error. I checked the file and the file is there and the security is ok.
Anyway, to resolve this error set the following element to false in the .vbproj project file:


Reload the project and build. 

Unable to open module file 'C:\Users\[NomeUtente]\AppData\Local \Temp\.NETFramework,Version=v4.0,Profile=Client.AssemblyAttributes.vb': Impossibile trovare il file specificato

Unable to open module file 'C:\Users\[NomeUtente]\AppData\Local \Temp\.NETFramework,Version=v4.0,Profile=Client.AssemblyAttributes.vb': Impossibile trovare il file specificato

Il motivo di questo errore di compilazione è ignoto. Il file è presente ed è accessibile.
La soluzione consiste nel aprire il file .vbproj del progetto che da errore e aggiungere questo elemento:


Ricompilare ed il problema dovrebbe essere risolto

mercoledì 25 maggio 2011

Error when using Microsoft Office Word Interop from a webservice

When trying to run a webservice that needs to access the Word application you can get the following error: 

"Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80070005."

Set the user identity to the AppPool containing the WebService to someting like Local System or Word will not run properly. You may also need to install the Microsoft Primary Interop Assemblies.

If the error persists, you need to enable the com access to the use. Run "dcomcnfg" and go to Component Services -> Computers -> My Computer -> DCOM Config.

At the end of the list you will find "{00020906-0000-0000-C000-000000000046}" right click on it and select properties, go to Security and in "Launch and Activation Permissions" set Customize -> Edit and set the permissions for the user identity used by the AppPool containing the WebService.

sabato 13 novembre 2010

Errore servizio SMTP IIS 'Unable to open the message for delivery'

Mi sono imbattuto in uno strano errore che impediva al servizo SMTP di IIS di mandare la posta.L'errore si manifestava con due sintomi.
Veniva scritto un evento di errore di Sistema con il seguente contenuto:Event Type: Warning
Event Source: smtpsvc
Event Category: None
Event ID: 4006
Date:  13/11/2010
Time:  22.52.19
User:  N/A
Computer: [...]
Message delivery to the host '[...]' failed while delivering to the remote domain '[...]' for the following reason: Unable to open the message for delivery.
For more information, see Help and Support Center at
0000: e0 02 04 c0               à..À   

Inoltre, nel percorso C:\Inetpub\mailroot\Queue il numero di file delle email continuava a crescere e le email non venivano spedite.

L'unico modo per risolvere il problema è stato disinstallare il componente SMTP da installazione applicazioni -> componenti di windows e reinstallarlo.

venerdì 15 ottobre 2010

Error calling a WebService method: "The request failed with HTTP status 401: Unauthorized."

If you get the error "The request failed with HTTP status 401: Unauthorized." when calling a .net web service running in IIS you must set the following properties in the calling application:

var ws = new localhost.WebService();

ws.Credentials = CredentialCache.DefaultCredentials;
ws.PreAuthenticate = true;

These settings will let you connect to the service.
If you need to you can manually specify credentials or use the credentials of the the calling application.

martedì 13 aprile 2010

Benchmark of the .Net Framework 4.0

I was interestend in the performance differences between the various .Net framework versions so I made a bunch of simple applications that does the following:
1) a loop that 500000000x adds a random number to an Int64
2) a loop that inserts 30000x random numbers in a listbox without BeginUpdate
3) a loop taht inserts 30000x random numbers in a listbox with BeginUpdate

I tested the Windows Forms using the .Net Framework 2.0, 3.5, 4.0 and the WPF using the .Net Framework 4.0 and these are the results:

.Net Framework 2.0:
Sum loop: 5968ms
Insert without BeginUpdate: 4393ms
Insert with BeginUpdate: 154ms

.Net Framework 3.5:
Sum loop: 5999ms
Insert without BeginUpdate: 4435ms
Insert with BeginUpdate: 159ms

.Net Framework 4.0:
Sum loop: 6024ms
Insert without BeginUpdate: 4634ms
Insert with BeginUpdate: 159ms

.Net Framework 4.0 WPF:
Sum loop: 6953ms
Insert: 155ms

The difference between the various versions of the .Net framework is really marginal, there is a trend that shows that every new version of the framework adds a bit of overhead.

The strange thing is that the loop code has nothing to do with the user interface. But when using the WPF is up to a second slower! I made the test many times and the result is always the same, the WPF code is slower than the same code in Windows Forms.

The UI responsiveness is nearly the same in this benchmark.
When resizing a form with anchored controls, bot tecnologies leaves a bit of lag on redraw. But the WPF implementation is better, feels more smooth. But the difference is not substantial.

In this benchmark the only substantial UI difference is that scrolling a big ListBox in WPF is laggy compared to the WF experience. In other words, when you drag the listbox's scrollbar in WPF it lags behind your mouse.

Here you can download the benchmark VS2010 project.