0

I have a WebApp that has some WebApi 2 in it, the WebApp is published on a server running with IIS.

When i add something new to the WebApp the update works fine and all the content is provided correctly, but now i've just made an update to an existing API and that API just doesn't return any content as the API still require the old parameters..

I've yet tryed to delete the cache files in /Microsoft.NET/Framework & Framework64 Temporary files folder for the following website but it hasn't had any effect..

So how can i force IIS to update my WebApp?

The API method i've changed is the following:

<HttpPost()>
<Route("rc")>
Public Function RepartiCassa(<FromBody()> ByVal where As ModelConfig.Config) As IEnumerable(Of Reparti)
    Dim re = Request
    Dim headers = re.Headers
    Dim piva As String = ""

    If headers.Contains("authToken") Then
        Dim token As String = headers.GetValues("authToken").First()
        Dim data = TokenManager.Principals(TokenManager.GetPrincipal(token))
        If data Is Nothing Then Return New HttpResponseMessage(HttpStatusCode.Unauthorized)

        piva = data.piva
    End If

    Dim modelConfig As ModelConfig = New ModelConfig

    Dim rep As Reparti = New Reparti
    Return rep.TotaliRepCassa(where.data.inizio, where.data.fine, modelConfig.QueryParametri(where.config, "TRC", False), piva)
End Function

While in the older version is looked as the following

<HttpPost()>
<Route("rc")>
Public Function RepartiCassa(<FromBody()> ByVal where As ModelConfig.Config) As IEnumerable(Of RepCassa)
    Dim re = Request
    Dim headers = re.Headers
    Dim piva As String = ""

    If headers.Contains("authToken") Then
        Dim token As String = headers.GetValues("authToken").First()
        Dim data = TokenManager.Principals(TokenManager.GetPrincipal(token))
        If data Is Nothing Then Return New HttpResponseMessage(HttpStatusCode.Unauthorized)

        piva = data.piva
    End If

    Dim modelConfig As ModelConfig = New ModelConfig

    Dim repCassa As RepCassa = New RepCassa
    Return repCassa.TotaliRepCassa(where.data.inizio, where.data.fine, modelConfig.QueryParametri(where.config, "TRC", False), piva)
End Function

All is changed is the model is of RepCassa become Reparti

NiceToMytyuk
  • 3,644
  • 3
  • 39
  • 100
  • Have you ever tried to restart app pool? Because depploy IIS won't refresh application and you also need to recycle app pool to refresh the complication. – Jokies Ding Apr 28 '20 at 09:13
  • @JokiesDing how could i restart the app pool? (ps: actually after some hours it updated all automatically, but anyway it will be cool to be able to refresh it manually) – NiceToMytyuk Apr 28 '20 at 09:17
  • 1
    https://blogs.iis.net/msdeploy/operations-on-application-pools-as-admin-and-non-admin This is a document about how to deploy and recycle app pool. – Jokies Ding Apr 28 '20 at 09:30
  • @JokiesDing yea actually that was it, it is even possible to just right click the app pool and press recycle in IIS, make an answer so i could accept it – NiceToMytyuk Apr 28 '20 at 16:32

3 Answers3

1

update project in IIS won't update app pool setting so it won't trigger application pool recycling.

Please try to recycle application pool manually or recycle app pool when you update project web deploy.

https://blogs.iis.net/msdeploy/operations-on-application-pools-as-admin-and-non-admin

Jokies Ding
  • 3,374
  • 1
  • 5
  • 10
0

If you see your changes when you add features, then this is most likely a problem with your code instead of IIS. My guess is your routing configuration needs to be updated.

David
  • 34,223
  • 3
  • 62
  • 80
0

For anyone who has tried the suggested solutions but still can't get your API to respond properly - consider that maybe the browser is caching the responses from your API endpoint. Try accessing your API Endpoint from another browser. That was the issue for me.

Stop Chrome From Caching

Disable Web API Caching