0

How to Add proxy configuration inside web.config file by removeing proxy from appsettings.json file in .net6 with Angular 5?

I tried to add proxy in web.config file by removing from appsetting.json file. Code added in web config file is as below :

<aspNetCore processPath=".\foo.f00.exe" stdoutLogEnabled="false" stdoutLogFile=".\log..\stdout" hostingModel="inprocess">
  <environmentVariables>
  <environmentVariable name="http_proxy" value=http://myproxy.abc.com:8080/>
  <environmentVariable name="https_proxy" value=https://myproxy.abc.com:8080/>
  <environmentVariable name="no_proxy" value=".local,.www.com"/>
</environmentVariables>

If i write only https and no_proxy then application runs without any exception. But When I write http proxy and run application then it throws exception on code as below:-

app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions
{
  HotModuleReplacement = true
});

And Error as below:

System.AggregateException: 'One or more errors occurred. 
(Unexpected character encountered while parsing value: <. Path '', 
line 0, position 0.)'

geetting in startup.cs file on UseWebpackDevMiddleware

Now Expectation is that, How to remove above error? And Is WebpackDevMiddlewareOptions, HotModuleReplacement is supports http value in .net6 with angular5?

2
  • i guess you missing " in value="com:8080" Commented May 25, 2023 at 16:57
  • The above value is for example only actually my value is like: <environmentVariable name="http_proxy" value="abc.pqr.com:8080"> and only because of this value i.e (http://..) webpackdevmiddlewareoptions { HotModuleReplacement=true } is throwing exception. If I pass only Https (Secured) value including no_proxy then Not getting any Exception. Commented May 26, 2023 at 5:39

0