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, |
Beta Was this translation helpful? Give feedback.
Replies: 15 comments
-
Thanks for reaching out! What operating system are you working on? |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for your help and fast response! Thats what I am developing on:
Regards |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
Sure, great thanks! THX's in advance Code
|
Beta Was this translation helpful? Give feedback.
-
Thank you so much, I'll try to repro it asap |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Nice! Thank you for taking your time! When starting the proxy the first time I got the certificate prompt, I confirmed it. Regards |
Beta Was this translation helpful? Give feedback.
-
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& |
Beta Was this translation helpful? Give feedback.
-
Cool, thanks for sharing. I'll try to repro on .net 4.8. I suspect I can use the same code as-is? |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
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 proxy Hope this helps. @garrytrinder we should add this to our docs |
Beta Was this translation helpful? Give feedback.
-
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, |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
It was great working with you! Using your tool together with MSGraph Client library is a pleasure! |
Beta Was this translation helpful? Give feedback.
-
Thank you for the kind words, it means a lot 😊 |
Beta Was this translation helpful? Give feedback.
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
command (run as admin):When you're done, you can reset the WinHTTP settings by calling:
netsh winhttp reset proxy
Hope this helps.
@garrytrinder we should add this to our docs
/cc: @gavinbarron @sebastienlevert