locked
VS2015 Publishing Profile - IIS - Not finding .cs file RRS feed

  • Question

  • User-851967432 posted

    Hello all,

    I'm deploying my site to my local IIS through the publishing wizard which appears to be precompiling with out checking the option.

    When I browser the page, I get an error that says the associated code .cs file cannot be found.

    The Publishing wizard doesn't send the designer or .cs file with the .aspx page.

    When I just copy the entire site and paste every file, it works fine.

    Is there a setting in IIS or the web.config that tells IIS it's a precompiled site?

    Thanks,

    Adam

    Wednesday, May 2, 2018 12:58 PM

All replies

  • User283571144 posted

    Hi adamturner34,

    As far as I know, if you enable the precompiled site setting, it will not copy all the cs file to IIS.

    It will only generate the assembly in the bin folder.

    I have also create a test demo deployment with precompiled setting on my side, it works well.

    I suggest you could firstly locate the C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files to delete the temp web site folder.

    Then I suggest you could republish your web site with deployment setting as below:

    My deployment setting:

    The generated folder.

    More details about how precompilation work in asp.net web site, I suggest you could refer to below article.

    https://msdn.microsoft.com/en-us/library/399f057w(v=vs.85).aspx 

    Best Regards,

    Brando

    Thursday, May 3, 2018 3:18 AM
  • User-851967432 posted

    Are you using VS2015?

    Whether or not I check the precompile option, the result is the same. It's creating the assembly in the bin and not publishing the designer files.

    There are really 2 problems here but I've found a workaround.

    1. It always precompiles. This would be fine if I could figure out how to set IIS to recognize this.
    2. IIS will only work with the associated .cs and .designer files. It would read the assembly

    As I said, I just copy the entire project with .cs and .designer files to the virtual directory, IIS works fine. If I use the publishing wizard, IIS won't read the assembly.

    This is my question, is there a setting in IIS to tell it to read the assembly?

    Thursday, May 3, 2018 2:14 PM
  • User-851967432 posted

    No. I created a web application.

    Friday, May 4, 2018 6:34 PM
  • User475983607 posted

    adamturner34

    No. I created a web application.

    Then this problem does not make sense as the cs files are compiled into the DLL when the site is a web application.  Since deploying the cs files works you must have created a web site.

    Friday, May 4, 2018 7:35 PM
  • User-851967432 posted

    It makes sense. You are right and that's the problem I'm facing. It is a web application and the .cs files are compiled into the assembly. The problem is IIS. It will not serve the web application with the .cs files compiled in the assembly. It's reading the page directives and looking for the physical .cs files.

    The only way I can get IIS to serve the .aspx pages, is to copy/paste the .cs and .designer files to the virtual directory.

    My question is...is there a way to tell IIS it's web application not a web site?

    Friday, May 4, 2018 7:58 PM
  • User475983607 posted

    adamturner34

    It makes sense. You are right and that's the problem I'm facing. It is a web application and the .cs files are compiled into the assembly. The problem is IIS. It will not serve the web application with the .cs files compiled in the assembly. It's reading the page directives and looking for the physical .cs files.

    Right, when the page directive points to a file you have a web site not a web application. A web application's page directive has the namespace not the actual file name.

    IIS is just doing what it is told. It is reading the page directive and trying to load the assembly.  See the following doc; https://msdn.microsoft.com/en-us/library/dd547590(v=vs.110).aspx

    adamturner34

    My question is...is there a way to tell IIS it's web application not a web site?

    I posted a link that shows how to convert a website to a web application which involves updating the page directive.  There is also a link that explains how to pre-compile a web site project which is a little involved.

    Friday, May 4, 2018 8:07 PM