Question Using developer proxy with Microsoft Graph .NET Client Library 5.x #1232
|
Hi and thank you for this super cool tool! Here my coding: I thought using Microsoft Graph .NET library translates the C#-Requests to HTTP calls?! What did I miss? Thank you very much in advance, |
Replies: 15 comments
|
Thanks for reaching out! What operating system are you working on? |
|
Thank you very much for your help and fast response! Thats what I am developing on: Regards |
|
Could you please share a screenshot of proxy running? Also, do you have a minimal repro setup of your app that we could use just to ensure that we're looking at the same thing? I appreciate your help in getting to the bottom of this |
|
Sure, great thanks! THX's in advance Code |
|
Thank you so much, I'll try to repro it asap |
|
Nice! Thank you for taking your time! When starting the proxy the first time I got the certificate prompt, I confirmed it. Regards |
|
I have news! I tested it like you with .Net7 and it works! I test again with .Net4.8 and still not working. Both At the moment I have no clue where to search for... If you have an idea where to look into please let me know. Thank you for your time& |
|
Cool, thanks for sharing. I'll try to repro on .net 4.8. I suspect I can use the same code as-is? |
|
I can indeed reproduce the issue on .net 4.8, where the same code is issuing web requests that are not intercepted by m365proxy. Let me dig deeper. Thanks again for bringing it up |
|
OK, I think I've got it. Seems like Microsoft Graph .NET SDK on .NET 4.8 uses an older HTTP adapter, which is configured to use WinHTTP API proxy settings rather than the internet proxy settings which the m365proxy enables on startup. To use m365proxy with .NET 4.8, you need to configure it as proxy with the WinHTTP API. You can do that using the netsh winhttp set proxy proxy-server="http=localhost:8000;https=localhost:8000"When you're done, you can reset the WinHTTP settings by calling: netsh winhttp reset proxyHope this helps. @garrytrinder we should add this to our docs |
|
That makes fun! Thank you for taking your time helping me out! I test it and as you mentioned with the setting the proxy it works flawlessly! Thank you for your help and keep on doing what you doing, |
|
Awesome! Thank you so much for bringing this gap in our docs to our attention and working with us to get to the bottom of it. Please, never hesitate to reach out if there's anything that we can help with. |
|
It was great working with you! Using your tool together with MSGraph Client library is a pleasure! |
|
Thank you for the kind words, it means a lot 😊 |




OK, I think I've got it. Seems like Microsoft Graph .NET SDK on .NET 4.8 uses an older HTTP adapter, which is configured to use WinHTTP API proxy settings rather than the internet proxy settings which the m365proxy enables on startup.
To use m365proxy with .NET 4.8, you need to configure it as proxy with the WinHTTP API. You can do that using the
netshcommand (run as admin):When you're done, you can reset the WinHTTP settings by calling:
netsh winhttp reset proxyHope this helps.
@garrytrinder we should add this to our docs
/cc: @gavinbarron @sebastienlevert