.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Unable to generate a temporary class

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :ADO.Net

I have two ASMX web services in the same IIS folder: WebService1.asmx and WebService2.asmx.  WebService1 works like it should work.  WebService2 works fine too, if consumed from a client developed in Visual Studio.  However, if I use the ASMX handler test page for WebService2 to Invoke a method in WebService2, I get the following error:

Unable to generate a temporary class (result=1).
error CS1026: ) expected
error CS1002: ; expected
error CS1525: Invalid expression term ')'
error CS1002: ; expected
error CS1525: Invalid expression term ')'
error CS1002: ; expected
error CS1026: ) expected

To do a controlled test, I have the exact same simple test method, GetHost(), which is simply: return Environment.MachineName; in both web services.  The one in WebService2 works fine if consumed from a developed client but will just produce the above error message when invoked from a browser on the WebService2.asmx page.

What could be happening?


View Complete Post

More Related Resource Links

How do I generate proxy class for webservice with no WSDL published?

 Hello, I need to utilize following web service: https://www.icds.att.com/xmlrequest Service publishes 2 XML files (one for Request and another for Response) https://www.icds.att.com/schemas/XMLRequest.xsd and https://www.icds.att.com/schemas/XMLResponse.xsd. I generated classes for those manually, but my question is how do I actually utilize web service (generate proxy file) in this case. Do I have to code everything manually?

XmlSerializer - how to define class to not generate attributes in root element?

Hi! I have simple class that I serialize to xml file: <?xml version="1.0" encoding="utf-8"?> <MyRootElement xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Area="East">   <Products>     <SalesProduct Taxable="true">       <Name>Sofa</Name>     </SalesProduct>     <Product>       <Name>Television</Name>     </Product>   </Products> </MyRootElement> I don`t want have in xml file attributes xmlns:xsi and xmlns:xsd. How can I define class to not have these two attributes in xml file? I tried use XmlRoot attribute but there is no control for these two attributes. They are always generated. Regards

Unable to create instance of proxy class in WCF

Hello, I created proxy class using svcutil.exe and added it in App_Webreference folder. I want to access objects and methods from this proxy. But I am unable to create instance of this proxy class. In inellisence, it is not showing this proxy class. What could be the problem ? I am using VS 2008 and Visual Basic.   Thanks in advance.  Amit Lohakare

Web Service Unable to access Directory (Temporary ASP.NET Files) CS0016

QuestionMoving web service to a production level server. This is not a new server, but is new to running an ASP.NET 2.0 web service. No other websites or services existed on this server.

Installed .Net 2 and specified that ASP is registered for 2.0 using aspnet_regiis. Installed missing components such as Front page extensions. When I try to browse to the services asmx page I get the error saying that the process has a compilation error and cannot access the asp.net temp directory under the 2.0 Framework. I looked at the directory and it appears that the asp.net process and others have correct access.

Note a basic asp.net page will come up as well as a basic html page.

All comments are welcome.

  • .Net 2
  • ASP.NET aspnet_regiis specifies .Net 2 as root
  • C#
  • IIS6
  • Windows Server 2003 SP1

Unable to Create Object Variable for Linq Data Class


For some unknown reason I suddenly am unable to create an object variable for a Linq Data Class. If I create a new project and try the process again with the same database everything works as advertized.

The code I am using is Dim db As New RoggDataContext  which gives me an error on the object variable "db": Overload resolution failed because no accessibility 'NEW'  accepts this number of arguments.

I have looked inside every file in the Web Project like the web config to check the connection string, gobal, and designer.vb looking for any errors whit no JOY.  I also tried to create a new form and code behind with a button and received the same error.

This is mind blowing because as I already stated, I can create a new Web Site and the problem goes away.

Any help is appreciated!



unable to create the component used to generate asp.net intellisense information


I have VS 2010 and I getting this error ? How do I fix this ?

"unable to create the component used to generate asp.net intellisense information.This can occur if VS or the .Net framework is not installed properly"

Unable to bind a List of a [DataContract] class to a ListBox




I have a class who is used by Silverlight though RIA Services and who contains the [DataContract] and on its properties [DataMember].

That class is also used by my WPF Application and i have a List<myClass> which i want to bind it on ListBox.


The problem is when i bind the list, when i select an item in my listbox, the first item is always selected and the right-click doesn't work properly.

In fact, the behavior of UI is weird and badly refreshed.

But, before, the class didn't have DataContract/DataMember attributes and it worked fine.


Do you know, a workaround to continue to use that class and avoid to create an other class specially for databind ?





Unable to cast COM oject of type 'System.__ComObject' to class type of 'System.Drawing.Bitmap' .

 private void DirectXViewer_DragDrop(object sender, DragEventArgs e)


   mousePressedFlag = false;



    Object obj = e.Data.GetData(typeof(Bitmap));





      Bitmap image = (Bitmap)((Bitmap)obj).Clone();

      RenderImage = image;



     catch(Exception ex)








private void DirectXViewer_MouseMove(object sender, MouseEventArgs e)


   if (mousePressedFlag)


    if(cacheBitmap != null)

     this.DoDragDrop(new Bitmap(cacheBitmap), DragDropEffects.Copy);




Hi All,

I try to d

Unable to pass parameter to a buisness class


YOur feedback would be appreciated...

I am getting this error 

Must declare the scalar variable "@InvoiceNumber".

in the following code, although i declared InvoiceNumber as a parameter in the Datasource object.

public class GetDetails
    public static DataSet Details(string InvoiceNumber)
        SqlConnection con = new   SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
        string sel = "Select InvoiceNumber,CustEmail, OrderDate,Subtotal"
               + " from [Invoices]"
               + " Where InvoiceNumber = @InvoiceNumber";
        SqlCommand cmd = new SqlCommand(sel, con);
        // Add the parameters for the SelectCommand.
       cmd.Parameters.AddWithValue("InvoiceNumber", InvoiceNumber);

How to auto-generate object initzializer code according to any given class definition?



I think this is at least somewhat connected to reflection so I posted it here.

I work with WCF and Web Services right now. Of course I use the tools provided to generate code from the WSDL documents, hence, for every datatype, a corresponding class is generated. As the WS has loads of types with nested subtypes, I get about 80 usually small classes, only having a few members. In order to implement all that, I have to initialize the classes over and over again.

So I wonder, if there is no way, to use reflection to automatically generate  code (object inizializer) from the class definition, including all subclasses?

Ideal would be a snipped - so that I just enter the name of any random class and dynamically get the full initializer generated. Do snippets actually have the power to do that?

As this will save a lot of stupid typing, I also wonder, if there aren't already any tools, snippets or widgets that do this? I assumed that is is something many programmers might need, but google did not show anything like it.

Thank you very much!

Generate XSD file from Class



If anyone knows a link to some documentation regarding generating xsd file from a class (the same as xsd.exe does), ie: how it works, what it uses, the concept / relation behind this conversion. I've tried to search the web and all i was pointed to was xsd.exe tool which doesn't work for my dll/class.


Dynamically Generate a WCF Proxy class at runtime and Callling web methods via reflection



I'm busy writing an application where the user will have to specify the location of a ?wsdl file for asmx and/or svc type services.

My application will have to :

1. Deduce from the wsdl what methods (with parameters and return types) are available on the service.

2. Provide a way to either generate a Proxy class in memory to execute methods against with e.g: Reflection

    for instanse : genericProxy.Invoke("HelloWorldMethod",parameter1,parameter2);

    I want to avoid using something like this : notSoGenericProxy.HelloWorldMethod(parameter1,parameter2); seeing that my application will have no 

    idea what service it will have to work with at runtime.

Is there a way to achieve this?

Thank you for any help in advance!

Unable to add reference to Class Library from a Workflow Console Application (VS 10 beta 2)

I got a really strange problem. I am using the beta 2 version of Visual Studio 10.

I have a Class Library, Activity Library and a Workflow Console Application. From the Workflow Console Application I want to make a reference to the Class Library (I've made some BusinessEntities there..), but I get the following error: 'The type or namespace name '<namespace name>' does not exist in the namespace blabla..

I made the reference, added it by typing using etcetera, but still getting error, also get an error where I import the reference (in the using part)

Can anyone help me out with this ? Is this a bug in Visual Studio 10 beta 2, or am I doing something wrong ?

SDF file generate by windows 7 is unable to use in windows XP


I tried to generate the sdf file at windows 7 that will be use in windows CE5. after i generated sdf file and i use management studio enterprise(at windows 7) to open the sdf, it show fine and workable.

But i put this sdf file put in the Windows XP, it show me different story. After i go deeper investigation, i found some of column may included a special and hiding character in front of the value. It cause the value unable to find it.

This only happen in Windows 7, whereas, Windows XP is no problem at all.


So, did any person was face this kind of problem? What is solution for this problem?

How can I generate property set event with attribute class?


I want to code design like below;

class Sample
            public string Prop1

            void MyChangesDelegate()

is that possible?

Class Diagrams

Class diagrams show the static structure of the systems. Classes define the properties of the objects which belong to them. These include:

Attributes - (second container) the data properties of the classes including type, default value and constraints.

Creating a Simple Class in C#

The second article in the C# Object-Oriented Programming tutorial describes how classes are created in C# and how behaviour, in the form of publicly visible and private, hidden methods can be added. This demonstrates some of the uses of encapsulation
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend