Solved

Compile Error

Posted on 2008-10-22
3
492 Views
Last Modified: 2013-11-07
I have created a class file that give me the following error:
Error      1      'MyIsysTest.HttpRuntime.HttpRuntime()' must declare a body because it is not marked abstract, extern, or partial.
The error is about this line:
public HttpRuntime();

I am not sure what is missing here.
using System;
using System.Configuration;
using System.Data.Common;
using System.Security;
using System.Web.Caching;
using System.Web.Compilation;
using System.Xml;
using System.Web;
 
namespace MyIsysTest
{
    public sealed class HttpRuntime
    {
        public HttpRuntime();
 
        // Summary:
        //     Gets the application identification of the application domain where the System.Web.HttpRuntime
        //     exists.
        //
        // Returns:
        //     The application identification of the application domain where the System.Web.HttpRuntime
        //     exists.
        public static string AppDomainAppId { get; private set; }
        //
        // Summary:
        //     Gets the physical drive path of the application directory for the application
        //     hosted in the current application domain.
        //
        // Returns:
        //     The physical drive path of the application directory for the application
        //     hosted in the current application domain.
        public static string AppDomainAppPath { get; private set; }
        //
        // Summary:
        //     Gets the virtual path of the directory that contains the application hosted
        //     in the current application domain.
        //
        // Returns:
        //     The virtual path of the directory that contains the application hosted in
        //     the current application domain.
        public static string AppDomainAppVirtualPath { get; private set; }
        //
        // Summary:
        //     Gets the application identification of the application domain where the System.Web.HttpRuntime
        //     exists.
        //
        // Returns:
        //     The unique application domain identifier.
        public static string AppDomainId { get; private set; }
        //
        // Summary:
        //     Gets the folder path for the ASP.NET client script files.
        //
        // Returns:
        //     The folder path for the ASP.NET client script files.
        //
        // Exceptions:
        //   System.Web.HttpException:
        //     ASP.NET is not installed.
        public static string AspClientScriptPhysicalPath { get; private set; }
        //
        // Summary:
        //     Gets the virtual path for the ASP.NET client script files.
        //
        // Returns:
        //     The virtual path for the ASP.NET client script files.
        public static string AspClientScriptVirtualPath { get; private set; }
        //
        // Summary:
        //     Gets the physical path of the directory where the ASP.NET executable files
        //     are installed.
        //
        // Returns:
        //     The physical path to the ASP.NET executable files.
        //
        // Exceptions:
        //   System.Web.HttpException:
        //     ASP.NET is not installed on this computer.
        public static string AspInstallDirectory { get; private set; }
        //
        // Summary:
        //     Gets the physical path to the /bin directory for the current application.
        //
        // Returns:
        //     The path to the current application's /bin directory.
        public static string BinDirectory { get; private set; }
        //
        // Summary:
        //     Gets the System.Web.Caching.Cache for the current application.
        //
        // Returns:
        //     The current System.Web.Caching.Cache.
        //
        // Exceptions:
        //   System.Web.HttpException:
        //     ASP.NET is not installed.
        public static Cache Cache { get; private set; }
        //
        // Summary:
        //     Gets the physical path to the directory where the common language runtime
        //     executable files are installed.
        //
        // Returns:
        //     The physical path to the common language runtime executable files.
        public static string ClrInstallDirectory { get; private set; }
        //
        // Summary:
        //     Gets the physical path to the directory where ASP.NET stores temporary files
        //     (generated sources, compiled assemblies, and so on) for the current application.
        //
        // Returns:
        //     The physical path to the application's temporary file storage directory.
        public static string CodegenDir { get; private set; }
        //
        // Summary:
        //     Gets a value that indicates whether the application is mapped to a universal
        //     naming convention (UNC) share.
        //
        // Returns:
        //     true if the application is mapped to a UNC share; otherwise, false.
        public static bool IsOnUNCShare { get; private set; }
        //
        // Summary:
        //     Gets the physical path to the directory where the Machine.config file for
        //     the current application is located.
        //
        // Returns:
        //     The physical path to the Machine.config file for the current application.
        public static string MachineConfigurationDirectory { get; private set; }
 
        // Summary:
        //     Removes all items from the cache.
        public static void Close();
        //
        // Summary:
        //     Returns the set of permissions associated with code groups.
        //
        // Returns:
        //     A System.Security.NamedPermissionSet object containing the names and descriptions
        //     of permissions, or null if none exists.
        public static NamedPermissionSet GetNamedPermissionSet();
        //
        // Summary:
        //     Drives all ASP.NET Web processing execution.
        //
        // Parameters:
        //   wr:
        //     An System.Web.HttpWorkerRequest for the current application.
        //
        // Exceptions:
        //   System.ArgumentNullException:
        //     The wr parameter is null.
        public static void ProcessRequest(HttpWorkerRequest wr);
        //
        // Summary:
        //     Terminates the current application. The application restarts the next time
        //     a request is received for it.
        public static void UnloadAppDomain();
    }
}

Open in new window

0
Comment
Question by:MoniMatthews
3 Comments
 
LVL 1

Accepted Solution

by:
MichaelVlasov earned 500 total points
ID: 22781455
You must implement a body for constructor (and for all methods):

public HttpRuntime()
{
  // some initialization code here
}

As I see in your sample, you missing body for all methods (not only constructor).
0
 
LVL 13

Expert Comment

by:TechTiger007
ID: 22781493
if you are planning to declare the methods are abstract then you have to declare them abstract other wise provide a body for the methods

public HttpRuntime();
should be changed to
public HttpRuntime()
{
}

do the same for other methods also


0
 

Author Closing Comment

by:MoniMatthews
ID: 31508970
Thank you for this fix.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

785 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