Cannot access class in web application when deploying to IIS

What I'm trying to do : I am developing a test ASP.Net web application. I am creating it using VS2017. I am trying to deploy it to the IIS server hosting the site and Intranet content. I have a simple class with void function and am trying to call this from Webform.

Problem . When I run this code in VS debugging, it compiles and runs fine. However, when I deploy it to the ISS server, it will not work

What I've done. . I made sure that the Class Build action is set to Compile. I changed the structure from 4.6 to 4.0. I tried to publish using VS function. I tried to just copy everything to the source folder directly to the wwwroot folder.

WebForm:

using System;    
namespace Efile {
    public partial class efile : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            test();
        }
        public void test()
        {
            Classy1 test1 = new Classy1();
        }
    }
}

Grade:

using System;
namespace Efile
{
    public  class Classy1
    {
        public void testy()
        {
        }
    }
}

Source Error:

Line 18:         public void test()
Line 19:         {
Line 20:             Classy1 test1 = new Classy1();
Line 21:         }
Line 22:     }


Source File: c:\inetpub\wwwroot\TestSite\efile.aspx.cs    Line: 20 

Compiler error message: CS0246: type or namespace name 'Classy1' could not be found (do you miss the use directive or assembly link?)

+4
source share

Source: https://habr.com/ru/post/1694072/


All Articles