title: Progressive Web App With .NET Core and .cshtml Files
body: <p>Hello I am trying to turn my Angular 2+ application into a progressive web app and am running into some issues and am not sure if I am using my service worker correctly.  I have 2 main questions on how I should be setting this up.</p>
  
  <p>First, I am seeing the following error in my console and not sure what I need to change to get the correct URL for the "starturl"...</p>
  
  <blockquote>
    <p>Site cannot be installed: no matching service worker detected. You may
    need to reload the page, or check that the service worker for the
    current page also controls the start URL from the manifest</p>
  </blockquote>
  
  <p>Here is my plugin in webpack (this seems to be generating my manifest.json correctly I just am not sure what I should be using as the start_url). I pulled this example from a Google Developers blog.  All my application resouces (service-worker.js, manifest.js, bundled js/css) is going into a dist folder.</p>
  
  <pre><code>new ManifestPlugin({
      fileName: 'manifest.json',
      seed: {
          name: "Angular Testing",
          short_name: "Angular Testing",
          theme_color: "#b92b27",
          background_color: "#ffffff",
          display: "standalone",
          orientation: "portrait",
          start_url: "./?utm_source=web_app_manifest",
          icons: [
              {
                  src: "../../icons/android-chrome-192x192.png",
                  sizes: "192x192",
                  type: "image\/png"
              },
              {
                  src: "../../icons/android-chrome-256x256.png",
                  sizes: "256x256",
                  type: "image\/png"
              },
              {
                  src: "../../icons/android-chrome-256x256.png",
                  type: "image/png",
                  sizes: "512x512"
              }
          ]
      }
  })
  </code></pre>
  
  <p>I have tried a combination of different start_urls but nothing has got rid of that error in the console and I cannot install the application.</p>
  
  <p>My second issue is not understanding if I am caching my service-worker resources correctly. In all the examples everyone has a Index.html file that is in the root of their project but in my .NET Core application I have my _Layout.cshtml and my Index.cshtml which make up the entry for the application.</p>
  
  <pre><code>new SWPrecacheWebpackPlugin({
      navigateFallback: '/Home/Index',
      staticFileGlobs: [
          '/',
          '/Home/Index.cshtml',
          '/Home/Index',
          '/Shared/_Layout',
          'wwwroot/dist/**.js',
          'wwwroot/dist/**.css',
          'wwwroot/dist/**.png'
      ],
      mergeStaticsConfig: true, // if you don't set this to true, you won't see any webpack-emitted assets in your serviceworker config 
      staticFileGlobsIgnorePatterns: [/\.map$/], // use this to ignore sourcemap files 
  })
  </code></pre>
  
  <p>I have configured my service worker to be generated using the above plugin in webpack but I am not sure how I should be specifying my Index.cshtml so be sure it gets cached.  </p>
  
  <p>When I look in my "Cache Storage" under the console I am not seeing some of the files I would expect to be cached including any of the cshtml files.  Is there something special I need to do to get this working?</p>
  
  <p><a href="https://i.stack.imgur.com/Fmc4A.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fmc4A.png" alt="Cache Storage Screenshot"></a></p>
  
  <p>Any help is appreciated.</p>