Work in VS2005 dev server, but not in IIS

My web page work in VS2005 dev server, but not in IIS. I have a lot of other WebPages that run well in IIS with asp.net 2.x. The problem is that my custom made class and namespace won't work.... why?


Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0246: The type or namespace name 'util' could not be found (are you missing a using directive or an assembly reference?)

Source Error:

 

Line 9:  using System.Web.UI.WebControls.WebParts;
Line 10: using System.Web.UI.HtmlControls;
Line 11: using util;
Line 12:
Line 13: public partial class _01_hovedsider_02_produkter_TestLastScheduledRun : System.Web.UI.Page

m-jansenAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
GavinMannionConnect With a Mentor Commented:
How did you create it....

Is it part of a different project? If so you need to publish that website (if it's a web) first then it will create a bin folder in that ones project with the dll.
0
 
Bob LearnedCommented:
What is util?  Where is located in the web site hierarchy?

Bob
0
 
m-jansenAuthor Commented:
This is util (Email.cs placed in the App_Code folder)

using System;
using System.Data;
using System.Text;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Net;
using System.Net.Mail;
using System.IO;
using System.Net.Mime;
using System.Data.OleDb;

/// <summary>
/// Summary description for Email
/// </summary>
namespace util
{
    public class Email : System.Web.UI.Page
    {
        // alot of things here......
    }
}
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
Bob LearnedCommented:
Do the project have a reference to the namespace in the web.config file (ASP.NET 2.0 assumed)?

Bob
0
 
m-jansenAuthor Commented:
no. how to add that? Why does it work in the dev server and not in IIS?
0
 
m-jansenAuthor Commented:
I run ASP.NET 2.0.
0
 
Bob LearnedCommented:
Because with 2.0, namespaces are stored in the web.config file, so you need to replicate that for the remote machine.

Here's an example from one of mine:

...

<pages>
 <namespaces>
   <add namespace="Microsoft.VisualBasic"/>
   <add namespace="System.Data"/>
   <add namespace="System.Drawing"/>
 </namespaces>

</pages>

</system.web>

Bob
0
 
m-jansenAuthor Commented:
This is how my web.config looks like. I tried to add it and it compiles, but I get the same error as before.

<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <configSections>
    <sectionGroup name="microsoft.web" type="Microsoft.Web.Configuration.MicrosoftWebSectionGroup">
      <section name="converters" type="Microsoft.Web.Configuration.ConvertersSection"/>
    </sectionGroup>
  </configSections>
  <microsoft.web>
    <converters>
      <add type="Microsoft.Web.Script.Serialization.Converters.DataSetConverter"/>
      <add type="Microsoft.Web.Script.Serialization.Converters.DataRowConverter"/>
      <add type="Microsoft.Web.Script.Serialization.Converters.DataTableConverter"/>
    </converters>
  </microsoft.web>
  <system.web>
    <customErrors mode="Off"/>

    <httpHandlers>
      <add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false"/>
      <remove verb="*" path="*.asmx"/>
      <add verb="*" path="*.asmx" type="Microsoft.Web.Services.ScriptHandlerFactory" validate="false"/>
    </httpHandlers>
    <httpModules>
      <add name="ScriptModule" type="Microsoft.Web.Services.ScriptModule"/>
    </httpModules>
    <pages>
      <controls>
        <add namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/>
        <add namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/>
        <add namespace="util" assembly="util" tagPrefix="util"/>
      </controls>
    </pages>
    <compilation debug="true"/>
  </system.web>
</configuration>
0
 
m-jansenAuthor Commented:
I also tried this:
    <pages>
      <controls>
        <add namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/>
        <add namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/>

      </controls>
      <namespaces>
        <add namespace="util"/>
      </namespaces>
    </pages>
Getting the same error
0
 
m-jansenAuthor Commented:
I don't understand why you are adding
   <add namespace="Microsoft.VisualBasic"/>
   <add namespace="System.Data"/>
   <add namespace="System.Drawing"/>
in the web.config

this in a cs file does also work in my web pages in ASP.NET 2.0.
using Microsoft.VisualBasic;
using System.Data;
using System.Drawing;

0
 
Bob LearnedCommented:
Did I say that the web site was C#--it is VB.NET.  You can always add Microsoft.VisualBasic, if you want VB.NET-specific code, but that is a different question.

Are you saying that the web.config file is the one on the server?

Bob
0
 
m-jansenAuthor Commented:
In VS2005 it is possible to add a web.config file to the web page project. This file is being run at the server. However it is not necessary to use a web.config if it is just a simple asp.net 2.0 web site without atlas and such things...
0
 
Bob LearnedCommented:
There are so many things stored in the web.config file now, like references and namespaces, that I would just keep one in there.

If you have the Web Site model, then just drop one into the folder.  If you have the Web Application model, and a project, then you can add a new item, and select configuration file.

Bob
0
 
m-jansenAuthor Commented:
Actually I get this error when creating a fresh Web.Config file in the folder I have the aspx script.

Server Error in '/dhh6' Application.
--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0246: The type or namespace name 'util' could not be found (are you missing a using directive or an assembly reference?)

Source Error:

 

Line 14:       <pages>
Line 15:         <namespaces>
Line 16:           <add namespace="util"/>
Line 17:         </namespaces>
Line 18:       </pages>
 

Source File: c:\Documents and Settings\All Users\Dokumenter\dhh\www\01_hovedsider\02_produkter\Web.config    Line: 16



Show Detailed Compiler Output:


C:\WINDOWS\system32> "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\csc.exe" /t:library /utf8output /R:"C:\WINDOWS\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a\System.Web.Mobile.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\dhh6\6aa96538\59d3ed66\assembly\dl3\59f5c7cf\00c23537_5559c601\Microsoft.Web.Atlas.DLL" /R:"C:\WINDOWS\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll" /out:"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\dhh6\6aa96538\59d3ed66\App_Web_testlastscheduledrun.aspx.c15d1574.eymcubr2.dll" /D:DEBUG /debug+ /optimize- /w:4 /nowarn:1659;1699  "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\dhh6\6aa96538\59d3ed66\App_Web_testlastscheduledrun.aspx.c15d1574.eymcubr2.0.cs" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\dhh6\6aa96538\59d3ed66\App_Web_testlastscheduledrun.aspx.c15d1574.eymcubr2.1.cs" "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\dhh6\6aa96538\59d3ed66\App_Web_testlastscheduledrun.aspx.c15d1574.eymcubr2.2.cs"


Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.

c:\Documents and Settings\All Users\Dokumenter\dhh\www\01_hovedsider\02_produkter\Web.config(16,11): error CS0246: The type or namespace name 'util' could not be found (are you missing a using directive or an assembly reference?)

 



Show Complete Compilation Source:


Line 1:    <?xml version="1.0"?>
Line 2:    <!--
Line 3:        Note: As an alternative to hand editing this file you can use the
Line 4:        web admin tool to configure settings for your application. Use
Line 5:        the Website->Asp.Net Configuration option in Visual Studio.
Line 6:        A full list of settings and comments can be found in
Line 7:        machine.config.comments usually located in
Line 8:        \Windows\Microsoft.Net\Framework\v2.x\Config
Line 9:    -->
Line 10:   <configuration>
Line 11:       <appSettings/>
Line 12:       <connectionStrings/>
Line 13:       <system.web>
Line 14:         <pages>
Line 15:           <namespaces>
Line 16:             <add namespace="util"/>
Line 17:           </namespaces>
Line 18:         </pages>
Line 19:        
Line 20:       </system.web>
Line 21:   </configuration>
Line 22:  
 




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
0
 
GavinMannionCommented:
Have you tried just adding a reference the normal way?

Right Click Project --> Add Reference --> Browse --> Find util.dll and select it.
0
 
m-jansenAuthor Commented:
GavinMannion: I can't find the util.dll file in the App_Code folder or Bin folder. Looks like its being stored some strange place.
0
 
m-jansenAuthor Commented:
No it's not a part of another project. It is a website.
Ok. I see. So it's not making dll's when just building it?
0
 
GavinMannionCommented:
No 2005 does not create the dll for a website until the site is published....

I presume you got it working now??
0
 
m-jansenAuthor Commented:
yepp :) Thanks.
0
All Courses

From novice to tech pro — start learning today.