title: Google Drive API upload Fails after hosting it to IIS. showing the error as Failed to launch the Browser with
body: <p>I am using google external login in my application, and I need a functionality that user can upload images from the application to his google drive.</p>
  
  <p>In my localhost code the google drive file uploading functionality working fine, after hosting it to IIS user unable to upload the image.</p>
  
  <p>I have created an error log file. in that I found the below exception:</p>
  
  <blockquote>
    <p>System.AggregateException: One or more errors occurred. ---> System.NotSupportedException: Failed to launch browser with "<a href="https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&amp;response_type=code&amp;client_id=347588538121-jeali0jufd389gqsi4ge22ent3939b4m.apps.googleusercontent.com&amp;redirect_uri=http%3A%2F%2Flocalhost%3A60931%2Fauthorize%2F&amp;scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive" rel="nofollow noreferrer">https://accounts.google.com/o/oauth2/v2/auth?access_type=offline&amp;response_type=code&amp;client_id=347588538121-jeali0jufd389gqsi4ge22ent3939b4m.apps.googleusercontent.com&amp;redirect_uri=http%3A%2F%2Flocalhost%3A60931%2Fauthorize%2F&amp;scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive</a>" for authorization. See inner exception for details. ---> System.ComponentModel.Win32Exception: Access is denied</p>
  </blockquote>
  
  <p>In the redirect_uri I found "localhost". but after hosting it should be www.abc.com, and the port number is also always varying here.</p>
  
  <p>Tried in many ways from the stachoverflow and other websites. but did not find the solution.</p>
  
  <p>Please help me to resolve this.</p>
  
  <p>Thanks.</p>
  
  <p>Tried with</p>
  
  <pre><code>credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
      obj,
      Scopes,
      "user",
      CancellationToken.None,
      new FileDataStore(AppDomain.CurrentDomain.BaseDirectory + "Daimto.GoogleDrive.Auth.Store")
  ).Result;
  
  </code></pre>
  
  <p>and also with:</p>
  
  <pre><code>using (var stream = new FileStream(Path.Combine(AppDomain.CurrentDomain.BaseDirectory) + "credentials.json", FileMode.Open, FileAccess.Read))
  {
      // The file token.json stores the user's access and refresh tokens, and is created
      // automatically when the authorization flow completes for the first time.
      string credPath = AppDomain.CurrentDomain.BaseDirectory + "token.json";
      credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
          GoogleClientSecrets.Load(stream).Secrets,
          Scopes,
          "user",
          CancellationToken.None,
          new FileDataStore(credPath, true)).Result;
  }
  </code></pre>