Azure / App-Service-Migration-Assistant

Azure Websites Migration Assistant for Windows is a tool that allows customers to move their existing sites hosted on IIS servers into the cloud on Azure App Service. For more information check out https://appmigration.microsoft.com .
https://appmigration.microsoft.com
MIT License
76 stars 60 forks source link

Session fced34c0-533f-4bed-8d9d-5c08c4baaeed. GETTING CONFIG: Object reference not set to an instance of an object. #27

Closed PaulShadwell closed 4 years ago

PaulShadwell commented 4 years ago

Investigative information

Please provide the following:

Repro steps

Provide the steps required to reproduce the problem:

Edited the applicationHost.config to remove a Location Tag. When I removed the tag and re-ran the Migration Assistant I get the error. I have to close and reopen Migration Assistant to get it to work again. When I put the location tag back in the Assistant works but shows an error saying that a Location tag exists.

Expected behavior

Provide a description of the expected behavior.

That the Migration Assistant completes without error.

Actual behavior

Provide a description of the actual behavior observed.

See repro steps

Known workarounds

Provide a description of any known workarounds.

No work around

wadeh-ms commented 4 years ago

Hello,

What was in the location tag that you deleted? It sounds like simply removing it made your configuration invalid.

Thanks, -Wade

From: PaulShadwell notifications@github.com Sent: Friday, January 24, 2020 5:04 AM To: Azure/App-Service-Migration-Assistant App-Service-Migration-Assistant@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [Azure/App-Service-Migration-Assistant] Session fced34c0-533f-4bed-8d9d-5c08c4baaeed. GETTING CONFIG: Object reference not set to an instance of an object. (#27)

Investigative information

Please provide the following:

Repro steps

Provide the steps required to reproduce the problem:

Edited the applicationHost.config to remove a Location Tag. When I removed the tag and re-ran the Migration Assistant I get the error. I have to close and reopen Migration Assistant to get it to work again. When I put the location tag back in the Assistant works but shows an error saying that a Location tag exists.

Expected behavior

Provide a description of the expected behavior.

That the Migration Assistant completes without error.

Actual behavior

Provide a description of the actual behavior observed.

See repro steps

Known workarounds

Provide a description of any known workarounds.

No work around

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2FApp-Service-Migration-Assistant%2Fissues%2F27%3Femail_source%3Dnotifications%26email_token%3DAJOMS7NIAHFOSL2HPLU6BI3Q7LRMTA5CNFSM4KLF3EU2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IIQNS3Q&data=02%7C01%7Cwadeh%40microsoft.com%7C866b5f868c7b4c09b16408d7a0cde6c0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637154678515822841&sdata=YIE%2BQ6VX3s82KC4%2BejrbJ3k5ZlDkqIqwGdOe1YKMZDA%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAJOMS7KJXYKRZXY34CICKRDQ7LRMTANCNFSM4KLF3EUQ&data=02%7C01%7Cwadeh%40microsoft.com%7C866b5f868c7b4c09b16408d7a0cde6c0%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637154678515827836&sdata=RHVdLwhy%2BmT2p%2FzITZaSYngEY4VpegiuaocNiBvVQ8c%3D&reserved=0.

GeoffScott2020 commented 4 years ago

Hi Paul, I would love to help but the purpose for posting is that it sounds like we have the same problem. I have the following error reported by the Azure App Service Migration: "The following location tags were found in applicationHost.config: "

After reviewing the help against the "Learn More" link (https://github.com/Azure/App-Service-Migration-Assistant/wiki/Readiness-Checks#location-tags), I removed the tag from the applicationHost.config file and placed it in the application's root web.config file. I did this because the help specifically says: "Generally, these entries can be moved to either the site's root web.config file, or to a web.config file associated with the specific application to which they apply. Once they've been moved to one of these locations, they can be migrated to Azure App Service with the site content."

After removing the offending tag from the applicationHost.config file, the Azure App Service Migration Assistant no longer works and gives the following error: "We're sorry, there has been an error. To get help, please use the Help > Report Issues menu option and include the following information: Session 0d5cda1c-7cb0-4a6e-80a8-ccd513825f66. GETTING CONFIG: Object reference not set to an instance of an object."

I cannot now see how to proceed because the Migration Assistant says I cannot have the location tag but it fails to even run when the tag is removed. I would be grateful if anyone can help.

Geoff

wadeh-ms commented 4 years ago

Hi Geoff,

I’m sorry that you are having issues.

I took a look at the information that I have for the session ID below. What I am seeing is that we failed to set a property on an object related to some basic authentication settings while reading your configuration. In this case, the error occurred even before the Migration Assistant was able to build a serialized and anonymized configuration to send in for assessment. As such, I don’t know what the specific pattern in your configuration is, that’s causing the problem.

I looked into the code, but didn’t see anything obvious that would cause this. So I tried to replicate your steps. Based on the above error, I assume that the location tag contained some basic authentication settings, so I set up basic authentication on one of my directories. This worked fine. So then I moved the basic authentication definitions from applicationhost.config into a web.config in the target directory and was able to reproduce the exception that you were seeing.

I did a little further investigation and discovered that the default applicationhost.config definitions do not allow delegation of basic authentication settings to a web.config file. This is something that you can enable. To do so, search your applicationhost.config file for the following line:

And change it to:

I am a bit surprised at the way that this is failing. I would expect that the IIS configuration system would fail outright upon trying to read a section that is not allowed to be delegated like this. A failure at that time would have been easier to report. But it appears that the read is succeeding, but not giving me a fully valid object. It’s only throwing the exception much later, when I go to access the object – specifically to anonymize it.

In any case, this should help to unblock you, and I can think about how to generally recognize this condition so that I can give a more helpful error.

Thanks very much for the report!

-Wade

From: GeoffScott2020 notifications@github.com Sent: Wednesday, February 12, 2020 6:38 AM To: Azure/App-Service-Migration-Assistant App-Service-Migration-Assistant@noreply.github.com Cc: Wade Hilmo wadeh@microsoft.com; Comment comment@noreply.github.com Subject: Re: [Azure/App-Service-Migration-Assistant] Session fced34c0-533f-4bed-8d9d-5c08c4baaeed. GETTING CONFIG: Object reference not set to an instance of an object. (#27)

Hi Paul, I would love to help but the purpose for posting is that it sounds like we have the same problem. I have the following error reported by the Azure App Service Migration: "The following location tags were found in applicationHost.config: "

After reviewing the help against the "Learn More" link (https://github.com/Azure/App-Service-Migration-Assistant/wiki/Readiness-Checks#location-tagshttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2FApp-Service-Migration-Assistant%2Fwiki%2FReadiness-Checks%23location-tags&data=02%7C01%7Cwadeh%40microsoft.com%7Ce0d7a31979c14b57485308d7afc93701%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637171151067136461&sdata=Us4I5Le6tkR0se6Kjdg%2BmwH7AKSnmOTXjpjI9TKwyQw%3D&reserved=0), I removed the tag from the applicationHost.config file and placed it in the application's root web.config file. I did this because the help specifically says: "Generally, these entries can be moved to either the site's root web.config file, or to a web.config file associated with the specific application to which they apply. Once they've been moved to one of these locations, they can be migrated to Azure App Service with the site content."

After removing the offending tag from the applicationHost.config file, the Azure App Service Migration Assistant no longer works and gives the following error: "We're sorry, there has been an error. To get help, please use the Help > Report Issues menu option and include the following information: Session 0d5cda1c-7cb0-4a6e-80a8-ccd513825f66. GETTING CONFIG: Object reference not set to an instance of an object."

I cannot now see how to proceed because the Migration Assistant says I cannot have the location tag but it fails to even run when the tag is removed. I would be grateful if anyone can help.

Geoff

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2FApp-Service-Migration-Assistant%2Fissues%2F27%3Femail_source%3Dnotifications%26email_token%3DAJOMS7KOXLFIGYYCOEO6MUTRCQCV7A5CNFSM4KLF3EU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELQ72OA%23issuecomment-585235768&data=02%7C01%7Cwadeh%40microsoft.com%7Ce0d7a31979c14b57485308d7afc93701%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637171151067136461&sdata=k%2FqGiLKYcmP3OkF58MDGCaAcp6%2FeurxuDfwlO%2BGm7Lg%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAJOMS7LOKJINLRLQQDNNDDLRCQCV7ANCNFSM4KLF3EUQ&data=02%7C01%7Cwadeh%40microsoft.com%7Ce0d7a31979c14b57485308d7afc93701%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637171151067146453&sdata=Z0F8T67oGz3bfrTYr5tA9pLRoG0%2FCgJijWWQslasaA8%3D&reserved=0.

GeoffScott2020 commented 4 years ago

Wade, Thank you so much for the response, you were quite right in your assumption about the basicAuthentication settings. So I went in and set the override mode to "Allow" but annoyingly this did not help. I got the same error (Session ID 82810e1e-0153-4205-92d5-22aebf9133d8).

Looking at the settings in the Location tag I thought: "I don't even need these, I'll just remove them". Below was how it appeared in the applicationHost.config before I started all this (when trying it in my local web.config, I just put the two settings directly between the existing </system.webServer> tags).

<location path="MyAppName">
    <system.webServer>
        <asp appAllowDebugging="true" bufferingOn="true">
            <session timeout="00:59:00" />
        </asp>
        <security>
            <authentication>
                <basicAuthentication enabled="false" />
            </authentication>
        </security>
    </system.webServer>
</location>

With those settings gone completely, I ran the Migration Assistant again and was surprised to see the following error "The following location tags were found in applicationHost.config: MyAppName".

I searched through the applicationHost.config file (this is in the C:\Windows\System32\inetsrv\config folder - just to be sure I'm in the right place) and the tags are definitely not there. I then removed all location tags for the other applications too (I have a backup of this file and these apps aren't critical to anything).

So now I have absolutely no Location tags at all. Guess what? Same error. It's beginning to feel like every time a door closes, another one slams in my face. Am I missing something obvious here? I have never done this before and don't generally delve into the config files except to sort out connectionstrings and appSettings.

To be honest, as it seemed to ignore the override setting and the complete removal of all location tags, it seems that either it's reading the configuration from elsewhere or it's somehow caching it. If you're able to help any further it would be very much appreciated.

wadeh-ms commented 4 years ago

Hi Geoff,

That sounds strange. Is it possible that you are using a 32 bit editor to modify applicationhost.config? If so, it’s possible that, under the covers, you are editing a file in c:\windows\syswow64\inetsrv\config. If that’s the case, then IIS won’t see any of your edits.

Here are a few other observations.

If the Migration Assistant is failing with an exception, then it’s very likely that the IIS configuration is actually broken. For example, if you tried to access the site affected by your original edit (where it was still set to deny), requests would have failed. Also, if you tried to read the configuration from the Configuration Editor in Internet Services Manager, then it would have also failed. The Migration Assistant is intended to work with sites that are fully functional and is pretty strict about it. If it finds any issues in the configuration, it will fail.

In looking at the default applicationhost.config file, the asp section is also configured with overrideModeDefault=”Deny”. It would produce the same error as the basic authentication section.

And finally, if you are unfamiliar with manually editing configuration files, there is a bit more to it than just cutting from applicationhost.config and pasting to a web.config. As you’ve seen with basic authentication, not all sections are allowed to be delegated. Some sections won’t work, even if you change the overrideModeDefault to “Allow”. In the future, I hope to add some better messaging, to help you to determine whether it’s viable to move a particular section from applicationhost.config or not. It turns out that it’s not a trivial problem to solve. I’m still in the research phase about how to handle this.

-Wade

From: GeoffScott2020 notifications@github.com Sent: Friday, February 21, 2020 1:28 AM To: Azure/App-Service-Migration-Assistant App-Service-Migration-Assistant@noreply.github.com Cc: Wade Hilmo wadeh@microsoft.com; Comment comment@noreply.github.com Subject: Re: [Azure/App-Service-Migration-Assistant] Session fced34c0-533f-4bed-8d9d-5c08c4baaeed. GETTING CONFIG: Object reference not set to an instance of an object. (#27)

Wade, Thank you so much for the response, you were quite right in your assumption about the basicAuthentication settings. So I went in and set the override mode to "Allow" but annoyingly this did not help. I got the same error (Session ID 82810e1e-0153-4205-92d5-22aebf9133d8).

Looking at the settings in the Location tag I thought: "I don't even need these, I'll just remove them". Below was how it appeared in the applicationHost.config before I started all this (when trying it in my local web.config, I just put the two settings directly between the existing </system.webServer> tags).

With those settings gone completely, I ran the Migration Assistant again and was surprised to see the following error "The following location tags were found in applicationHost.config: MyAppName".

I searched through the applicationHost.config file (this is in the C:\Windows\System32\inetsrv\config folder - just to be sure I'm in the right place) and the tags are definitely not there. I then removed all location tags for the other applications too (I have a backup of this file and these apps aren't critical to anything).

So now I have absolutely no Location tags at all. Guess what? Same error. It's beginning to feel like every time a door closes, another one slams in my face. Am I missing something obvious here? I have never done this before and don't generally delve into the config files except to sort out connectionstrings and appSettings.

To be honest, as it seemed to ignore the override setting and the complete removal of all location tags, it seems that either it's reading the configuration from elsewhere or it's somehow caching it. If you're able to help any further it would be very much appreciated.

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FAzure%2FApp-Service-Migration-Assistant%2Fissues%2F27%3Femail_source%3Dnotifications%26email_token%3DAJOMS7O4ZA6F745AJII6R7DRD6NB3A5CNFSM4KLF3EU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMSCOLI%23issuecomment-589571885&data=02%7C01%7Cwadeh%40microsoft.com%7Cc1325906f274426a5ab808d7b6b056e5%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637178740802000509&sdata=E8C%2FOhHhljVePEcXD9X67LTk5EWxIrhBQKBUAKw%2B04M%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAJOMS7OGBPSUA6HJHOB2WTDRD6NB3ANCNFSM4KLF3EUQ&data=02%7C01%7Cwadeh%40microsoft.com%7Cc1325906f274426a5ab808d7b6b056e5%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637178740802010477&sdata=751zAzhimlCwCQUIfH%2B7qLAgC7KGFhI7svC7h4nQnSc%3D&reserved=0.

GeoffScott2020 commented 4 years ago

Wade, Many thanks again. You were right about the 32bit editor problem. When you pointed this out, I looked at the 'modified' date/time stamp on the applicationHost.config file and saw that it had last year's date. I then checked the one in the syswow64 folder and saw that this was the one that changed. So I copied the one I actually wanted to change to my local machine, saw that it still had the unwanted location tag, removed it, and copied it back to the server. Job done! Now the migration assistant lets me proceed.

I don't know what surprised me more, the fact that it behaved this way, or the fact that you knew about it! Great job though, so thank you very much.

krolson commented 4 years ago

Looks like this issue was resolved for this user - closing issue - please open a new issue if still encountering a similar problem.