|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Use Mapi in web servicesome work by MAPI (change properties of some mails in a given users mailbox) .. The problem is when I put my web service under IIS the exception is thrown from Mapi it can't create profile i didn't try but co-worker says that it doesn't call correctly even MapiInitilize(). I try to enable anonymous access and change the anonymous user to Admin but it doesn't help. All work fine when i use VS2005 integrated Web Server or call Web Service by giving empty credential like this System.Net.CredentialCache cache = new System.Net.CredentialCache(); cache.Add(new Uri(url), "NTLM", new NetworkCredential()); service.Credentials = cache; Note that my Web Service function is calling before i use credential only com(mapi) is throwing exceptions. Isn't IIS anonymous user has same permissions as empty NetworkCredential because i am logged in from the same user? by the way i can't leave credentials in the client because i should call this service from Mac client. please help to understand what is the problem. Thanks a lot. Hi,
for performance reasons, IIS does not load the user profile by default, so the profiles are probably just not loaded into memory. That said, MAPI is not supported under .NET because its memory management conflicts with the .NET garbage collector. It will work most of the time but it will yield unexpected results here and there. You should switch the protocol over to WebDAV, CdoEx (via interop on the Exchange server) or WebServices (if you are using Exchange 2007). Redemption is another option (http://www.dimastr.com/redemption/). Kind regards, Henning Krause Show quote "arsenmkrt" <arsenm***@discussions.microsoft.com> wrote in message news:3B4FDE7F-6AB0-490C-837A-80FAEE7928AC@microsoft.com... > Hi. I develop an ASP.NET web service that calls COM Interop function which > do > some work by MAPI (change properties of some mails in a given users > mailbox) > . The problem is when I put my web service under IIS the exception is > thrown > from Mapi it can't create profile i didn't try but co-worker says that it > doesn't call correctly even MapiInitilize(). I try to enable anonymous > access > and change the anonymous user to Admin but it doesn't help. All work fine > when i use VS2005 integrated Web Server or call Web Service by giving > empty > credential like this > > System.Net.CredentialCache cache = new System.Net.CredentialCache(); > cache.Add(new Uri(url), "NTLM", new NetworkCredential()); > service.Credentials = cache; > > Note that my Web Service function is calling before i use credential only > com(mapi) is throwing exceptions. > Isn't IIS anonymous user has same permissions as empty NetworkCredential > because i am logged in from the same user? by the way i can't leave > credentials in the client because i should call this service from Mac > client. > please help to understand what is the problem. Thanks a lot. > "Henning Krause [MVP - Exchange]" <newsgroups_rem***@this.infinitec.de> See wrote in news:#mi6kxZEIHA.4140@TK2MSFTNGP03.phx.gbl: > That said, MAPI is not supported under .NET because its memory > management conflicts with the .NET garbage collector. It will work > most of the time but it will yield unexpected results here and there. http://blogs.msdn.com/mstehle/archive/2007/10/03/fyi-why-are-mapi-and-cdo- 1-21-not-supported-in-managed-net-code.aspx for the details of this. -- dan Show quote
"Dan Mitchell" wrote: Sorry, but I didn't use MAPI in .NET. My Web service call ATL COM dll (was > "Henning Krause [MVP - Exchange]" <newsgroups_rem***@this.infinitec.de> > wrote in news:#mi6kxZEIHA.4140@TK2MSFTNGP03.phx.gbl: > > That said, MAPI is not supported under .NET because its memory > > management conflicts with the .NET garbage collector. It will work > > most of the time but it will yield unexpected results here and there. > > See > > http://blogs.msdn.com/mstehle/archive/2007/10/03/fyi-why-are-mapi-and-cdo- > 1-21-not-supported-in-managed-net-code.aspx > > for the details of this. > > -- dan > write in C++) and this ATL COM dll WORKING WITH MAPI!!! Web service call ATL COM dll normaly but I think DLL canot load MAPI32.dll for initialize.... All problem only in it!!! What can I do? =?Utf-8?B?YXJzZW5ta3J0?= <arsenm***@discussions.microsoft.com> wrote in
news:E4162A31-A664-47A9-B27C-E4C2D328CEAF@microsoft.com: Then you're trying to call ExMAPI code from a .Net process -- the DLL > Sorry, but I didn't use MAPI in .NET. My Web service call ATL COM dll > (was write in C++) and this ATL COM dll WORKING WITH MAPI!!! gets loaded into the process space of your main app, which is a .Net app. If your code was a standard NT service which listened on port 80 and handled web requests without using the .Net runtime, it (hopefully) would be able to call the DLL okay, because the main process wouldn't be .Net any more. On the other hand, you'd have to write all the web request handling code yourself, which is probably more trouble than it's worth.. -- dan Show quote
"Henning Krause [MVP - Exchange]" wrote: Sorry, but I didn't use MAPI in .NET. My Web service call ATL COM dll (was > Hi, > > for performance reasons, IIS does not load the user profile by default, so > the profiles are probably just not loaded into memory. > > That said, MAPI is not supported under .NET because its memory management > conflicts with the .NET garbage collector. It will work most of the time but > it will yield unexpected results here and there. > > You should switch the protocol over to WebDAV, CdoEx (via interop on the > Exchange server) or WebServices (if you are using Exchange 2007). > > Redemption is another option (http://www.dimastr.com/redemption/). > > Kind regards, > Henning Krause > > > "arsenmkrt" <arsenm***@discussions.microsoft.com> wrote in message > news:3B4FDE7F-6AB0-490C-837A-80FAEE7928AC@microsoft.com... > > Hi. I develop an ASP.NET web service that calls COM Interop function which > > do > > some work by MAPI (change properties of some mails in a given users > > mailbox) > > . The problem is when I put my web service under IIS the exception is > > thrown > > from Mapi it can't create profile i didn't try but co-worker says that it > > doesn't call correctly even MapiInitilize(). I try to enable anonymous > > access > > and change the anonymous user to Admin but it doesn't help. All work fine > > when i use VS2005 integrated Web Server or call Web Service by giving > > empty > > credential like this > > > > System.Net.CredentialCache cache = new System.Net.CredentialCache(); > > cache.Add(new Uri(url), "NTLM", new NetworkCredential()); > > service.Credentials = cache; > > > > Note that my Web Service function is calling before i use credential only > > com(mapi) is throwing exceptions. > > Isn't IIS anonymous user has same permissions as empty NetworkCredential > > because i am logged in from the same user? by the way i can't leave > > credentials in the client because i should call this service from Mac > > client. > > please help to understand what is the problem. Thanks a lot. > > > > write in C++) and this ATL COM dll WORKING WITH MAPI!!! Web service call ATL COM dll normaly but I think DLL canot load MAPI32.dll for initialize.... All problem only in it!!! What can I do? Hi arsenmkrt,
Show quote "arsenmkrt" <arsenm***@discussions.microsoft.com> wrote in message My guess is that the profile cannot be created because in a service process news:3B4FDE7F-6AB0-490C-837A-80FAEE7928AC@microsoft.com... > Hi. I develop an ASP.NET web service that calls COM Interop function which > do > some work by MAPI (change properties of some mails in a given users > mailbox) > . The problem is when I put my web service under IIS the exception is > thrown > from Mapi it can't create profile i didn't try but co-worker says that it > doesn't call correctly even MapiInitilize(). I try to enable anonymous > access > and change the anonymous user to Admin but it doesn't help. All work fine > when i use VS2005 integrated Web Server or call Web Service by giving > empty > credential like this MAPI profiles are written to mmp files, by default in the windows directory and I assume that the account used to host the wep service does not have enough rights to create, change and delete files in that folder. Please use a tool like FileMon or ProcessMonitor to check for access denied errors from your web service. If you use IIS6 you need to watch the w3wp.exe, IIS5.x uses dllhost.exe. > System.Net.CredentialCache cache = new System.Net.CredentialCache(); I do not think that the above network credentials have any meaning to MAPI > cache.Add(new Uri(url), "NTLM", new NetworkCredential()); > service.Credentials = cache; > > Note that my Web Service function is calling before i use credential only > com(mapi) is throwing exceptions. > Isn't IIS anonymous user has same permissions as empty NetworkCredential > because i am logged in from the same user? by the way i can't leave > credentials in the client because i should call this service from Mac > client. > please help to understand what is the problem. Thanks a lot. calls. What uri do you use? This might work for http(s) where you can add those credentials to your http(s) client code. BTW what type is the service variable? You seem to think that the service object's Credentials property does have influence on the authentication of your MAPI calls. The easiest would be to run the wep service in a domain account which can access the mailbox you want to access through your web service. Otherwise you would at least need to create a logon session (LogonUser) and impersonate that logon in the thread you are using to do MAPI calls. But IIRC there are some posts around that do advise to not use impersonation with MAPI... -- SvenC "SvenC" <svenc@community.nospam> wrote in This is the official word on that:news:67061F74-8CC4-4A6F-B255-92A0F35287FC@microsoft.com: > But IIRC there are some posts around that do advise to > not use impersonation with MAPI... http://blogs.msdn.com/stephen_griffin/archive/2005/04/13/mapi-and- impersonation.aspx -- dan |
|||||||||||||||||||||||