?
Solved

Work in VS2005 dev server, but not in IIS

Posted on 2006-07-23
19
Medium Priority
?
818 Views
Last Modified: 2008-03-17
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

0
Comment
Question by:m-jansen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 11
  • 5
  • 3
19 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17163672
What is util?  Where is located in the web site hierarchy?

Bob
0
 

Author Comment

by:m-jansen
ID: 17163691
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
 
LVL 96

Expert Comment

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

Bob
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:m-jansen
ID: 17163731
no. how to add that? Why does it work in the dev server and not in IIS?
0
 

Author Comment

by:m-jansen
ID: 17163737
I run ASP.NET 2.0.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17163751
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
 

Author Comment

by:m-jansen
ID: 17163793
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
 

Author Comment

by:m-jansen
ID: 17163822
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
 

Author Comment

by:m-jansen
ID: 17163843
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17164542
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
 

Author Comment

by:m-jansen
ID: 17166522
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
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17166620
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
 

Author Comment

by:m-jansen
ID: 17166710
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
 
LVL 15

Expert Comment

by:GavinMannion
ID: 17166843
Have you tried just adding a reference the normal way?

Right Click Project --> Add Reference --> Browse --> Find util.dll and select it.
0
 

Author Comment

by:m-jansen
ID: 17166917
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
 
LVL 15

Accepted Solution

by:
GavinMannion earned 375 total points
ID: 17166933
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
 

Author Comment

by:m-jansen
ID: 17167766
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
 
LVL 15

Expert Comment

by:GavinMannion
ID: 17167913
No 2005 does not create the dll for a website until the site is published....

I presume you got it working now??
0
 

Author Comment

by:m-jansen
ID: 17167945
yepp :) Thanks.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question