Configuration of CORS tag in WEB.CONFIG in . NET project

Asked

Viewed 128 times

0

I have a problem with the CORS tag in my XML. It even recognizes in Visual Studio 2012, but in VS 2017 it compiles but does not debug. Libraries are installed, but still persist in error, even if it runs perfect on VS 12.

Is there any other alternative to the tag? what can I do to recognize?

Error while debugging: inserir a descrição da imagem aqui

The way I’m using: Forma como estou utilizando

Error happening in VS 17: Erro acontecendo no VS 17

I searched the error when debugging the solution: inserir a descrição da imagem aqui

1 answer

0


The keying of your Web.config is wrong, you should put so:

<system.webServer>
    <httpProtocol>
        <customHeaders>
            <add name="Access-Control-Allow-Origin" value="*"/>
            <add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,OPTIONS"/>
            <add name="Access-Control-Allow-Headers" value="Content-Type"/>
        </customHeaders>
    </httpProtocol>
</system.webServer>

I hope I helped friend

Browser other questions tagged

You are not signed in. Login or sign up in order to post.