0

Overview

I'm trying to patch an existing MVC 4 web app to MVC 5 and from Oracle DataAccess 11g to 12c. It runs fine locally in Visual Studio with no errors, with full functionality. However, when I move it to the dev server, I get the following error:

Compiler Error Message: CS0103: The name 'model' does not exist in the current context I looked at the following Stack Overflow posts, and tried the fixes there without any luck:

I think they don't really apply here because the errors in those posts are occurring in VS, which is working fine for me. Unless I'm looking in the wrong place, my issue appears to be with the settings in IIS on the dev server. That said, if you want me to post the web.config file(s) I can do so.

Application

As I said above, I tried all the fixes in the two links I provided, to no avail. My Web.config files both seem to be okay; at the very least I'm able to run locally without issues.

I'm running the latest version of MVC 5, Razor, etc: enter image description here

I also tried setting Copy Local to True for all DLLs, which was kind of a blind shot and didn't do anything.

When publishing the site I target "any CPU" and I do not precompile. I tried fiddling with both settings, and it doesn't seem to make a difference.

Server Stuff

My devops are unwilling or unable to help with this issue. When I go to them they simply say "what do you want me to do, it's the dev server." Server stuff isn't really my strong suit, so I'm in "poke and pray" mode.

The server is running Windows Server 2008 R2 with all the latest patches. When I look at the "installed programs" section of the Control Panel it shows .NET Framework 4.7.1.

When I look at the basic settings for the IIS app pool associated with the application it shows the .NET Framework version as .NET Framework v4.0.30319 with the Managed Pipeline Mode set to integrated. Is there a reason that it's different than 4.7.1? Again, IIS is not my field of expertise.

When I look at the Advanced Settings for the app pool it shows the framework version as 4.0, and "enable 32-bit" as false. Let me know if there are any other settings you'd like to know.

Both 32- and 64-bit versions of Oracle 12c are installed on the server. I verified this with the DBA.

This is incredibly frustrating, because it appears to be fine locally, and I'm not sure where to look to see what's different on the server. I'm getting zero help from the server guys in my department. Any help from here would be greatly appreciated.

Update Thanks for the comments, they contained excellent information. I had already tried making sure that the web.config files were available, and they were. What I wound up doing to fix the issue was to remove and recreate the "site" in IIS. I have no idea why that fixed it. As I said in the initial comment, I'm not a server guy

War2d2
  • 247
  • 1
  • 2
  • 10

2 Answers2

1

I was facing the same issue when deploying my application to server. In my case web.config file was missing in view folder of published application.Although it was there in actual project.

After I added it to back my view folder (Right click -> Add existing item) and on publishing the application. it started working.

Or if web.config file is not in view folder, you can create a new project with same project setting configuration, copy its View's web.config file into your actual project and add it to your project as mentioned previously.

Below is the step I followed to find the issue and fixed it. 1) Make "customError mode = on" in your home directory web.config file. This will show exception on screen. Or check the event viewer for details of warning or exception.

<system.web>
<customErrors mode="On" >       
        .....    
    </customErrors>
  </system.web>

2) Deploy your project application folder(project home directory) on local IIS. In my case it was working because view was able to find its web.config.

3) Publish your application and deploy it on local IIS. In this case applicaiton was not working because published binary was dropping the View's folder web.config file.

Please check this link as well to your error.

For Oracle dll, if app pool is "enable 32-bit = false" , it is expecting 64 bit oracle.DataAccess.dll. in this case you just have to replace/copy current oracle dll with 64 bit oracle dll in your bin folder. Make sure oracle client is installed or appropriate oracle dll is in GAC.

kumar chandraketu
  • 2,232
  • 2
  • 20
  • 25
  • Thanks for this comment. This is all excellent information. What I wound up doing to fix the issue was to remove and recreate the "site" in IIS. I have no idea why that fixed it. As I said in the initial comment, I'm not a server guy. – War2d2 Oct 11 '18 at 22:17
  • Thanks! My `Views\Web.config` wasn't included with the deployment as it was referenced in my `csproj` as `` instead of ``. – Bouke Dec 14 '21 at 21:35
0

I've faced the same problem. I solved this problem by doing the following steps.

  1. Check the files on the Server. In my case all files were available in the Repository but web.config file was missing on the Server.

  2. I added Web.config file to the Server following which all pages started working fine.

MS Srikkanth
  • 3,829
  • 3
  • 19
  • 33
Nikesh Pandya
  • 51
  • 2
  • 7