.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

Namespace Issue in Generated Code

Posted By:      Posted Date: October 25, 2010    Points: 0   Category :ASP.Net

I have a Solution in which I have A WCF Service web site project which then hosts two separate WCF Service Libraries (each in their own project).  One of the Web Services is a Client to the other. 

When I click the ClientService and select Add Service Reference, it all adds properly, but when I go to build it, I get this error in the reference.cs (the generated file).

The type name 'HostWCFService' does not exist in the type 'ClientService.ClientService' C:\Users\...\Reference.cs 

I don't want it to create a ClientService.HostWCFService namespace, I want to be able to use the HostWCFService as its own namespace.  I believe I've had this setup working before at one point; that is, I had this arrangement working before, but am not sure now if the host service was in a sub namespace of the project.

I was able to do: 

using HostWCFService;

instead of

using ClientService.HostWCFService;

Any thoughts? 

View Complete Post

More Related Resource Links

Issue with Proxy code when generated for WCF service



There is an issue I am going through when generating Proxy code for my WCF services. Whenever I generate Proxy code for services with methods having VALUE Type parameters, additional BOOL parameter <parameter>Specified is added to the generate Proxy Code.

So if I have method - Employee GetEmployee(int Id), the respective proxy code for this method will be - Employee GetEmployee(int Id, bool IdSpecified).

Moreover, if you do not set this bool parameter value to TRUE, no value will be passed to the End service.

I can understand this can come handy when handling Null inputs, but that will not be always the case.

After doing some R&D, I found that if I add Data Format attribute of type RPC to my Method contract, these parameters are removed. Like if I add: 

[DataContractFormat(Style = OperationFormatStyle.Rpc)] , the generated proxy code reflects all value type parameters as is.

I am not an expert in WCF, and for the same reason I don't have much idea on what significance this attribute plays for the service methods. Can adding this attribute introduce problems when consuming these methods by application in .NET 1.1 or in JAVA?


Can anyone help me in getting ride of this additional parameter in the proxy?

Thanks in Advance.




Repeater issue, all code inside Repeater are not shown


I have a Repeater who should show some data from my ms.sql server. But all code inside the Repater is not shown on my .aspx page. What am i doing wrong. I have a similar Repeater on another page and there it works fine.


 <div class="AnsaettelseKontrakt Folders">
      	            <table cellpadding="0" cellspacing="0" width="750px" align="right">
                            <th class="BrugerHeader" style="width:300px;">Filnavn</th>
                            <th class="BrugerHeader" style="width:80px;">Størrelse</th>
                            <th class="BrugerHeader" style="width:150px;">Dato</th>
                            <th class="BrugerHeader" style="width:180px;" colspan="2">Brugere</th>
                            <th class="BrugerHeader" style="width:40px;">Værktøjer</th>
                        <asp:Repeater ID="RepeaterAns" runat="server" onitemcommand="Repeater1_ItemCommand" >
                                <tr class="Br

SSIS And Sybase Source OLEDB connectivity issue with code page for character set

Hi I am using SSIS 2008 to connect the Sybase Server version 15.0.3 64-bit. The default character set id used by this Sybase server is 4 (i.e. roman8). (http://manuals.sybase.com/onlinebooks/group-charc/chg0300e/charsets/@Generic__BookTextView/1706;pt=266) I had installed Sybase Client for Sybase OLEDB Driver (ASEOLEDB) to integrate this in OLEDB Source Editor. As per guidance from one of the past MSDN forum discussion, I tried setting property of AlwaysUseDefaultCodePage property to "FALSE"  (http://social.msdn.microsoft.com/forums/en-US/sqlintegrationservices/thread/f5af9328-e1fb-48d7-a85d-1d08bb7cf0e5/). However, I am still experiencing error message as follows:- ********************************************************* Error at Package2 [Connection manager "xxxxxx.xxxxxxx"]: SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005. An OLE DB record is available.  Source: "ASEOLEDB"  Hresult: 0x80004005  Description: "[00000] [Native Code: 30061] [ASEOLEDB]Could not load code page for requested charset". An OLE DB record is available.  Source: "ASEOLEDB"  Hresult: 0x80004005  Description: "[1ZZ001] [Native Code: 30016] [ASEOLEDB]Internal Error". Error at Data Flow Task 2 [OLE DB Source [1]]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMC

SvcUtil-generated code or shared interface/data contract assembly?

If you control both service and client is there any benefit in using svcutil.exe to generate client proxies? Or is it better to share interface/data contract assembly between client and service?

Namespace resolution issue when loading activities designed in VS2010 in rehosted WorkflowDesigner

Hi. I have activities that is made in VS2010, that are to be used in a rehosted WorkflowDesigner app. In the rehosted app I have a WorkflowDesigner, a toolbox with all the standard and my custom activities, and a property window. The problem occures when I load a composite activity that has reference to other custom activities (and that is drawn in the designer in VS2010). In the rehosted app the composite activity is shown almost as expected, except that all the referenced activities are shown in the designer as a red error message: "Activity could not be loaded because of errors in the XAML."  If I load the same activity in VS2010 it works.  If I remove the referenced activity in the rehosted app and adds it from the toolbox there, it works. If I draw the composite activity in the rehosted app from "the ground up", it works. If I compare the activity XAML that is saved in VS2010, and the activity XAML when opened, modified and saved in the rehosted app, I find differences in how namespaces are expressed: The Activity-XAML from VS2010 has namespace resolution at the top: xmlns:local="clr-namespace:WCFWorkflowPOC" The Activity-XAML from the rehosted app does not save namespace resolution at the top. If I add the activity in the rehosted app insted of in VS2010, it places namespace resolution

Code behinds in MVC2 - How to inject auto-generated code into views via partial classes?

Background:I have written a t4 template that basically replaces the work done by StronglyTypedResourceBuilder to give design time access to string resources as properties of classes, one class per resource file.  Why?  Well I needed to add some customer code that handles string token substitution and a few other customizations.  Anyway, the template is working out really well and I may blog on it soon.In the mean time though, following a common pattern, I have one .resx file for each view, master page, controller, etc.  I would really like my t4 template to add a property to each such entity that gives quick access the custom resource class associated with it.  For controllers this is easy.  T4MVC is ensuring that they are a all declared partial.  All I need to do is create the appropriate partial class in my output that declares a readonly property that returns an instance of the appropriate generated resource class.The Problem:I would like to do the same thing, inject generated code, into my views.  Were this traditional ASP.Net, each .aspx page would have a .aspx.cs page and possibly an .aspx.designer.cs page that are all partial classes extending in the aspx page's class definition.  There is no such thing by default in MVC and for good reason.  However, I think for my purposes, if there is a way to do this, it

How to get rid of entitysets in code that is generated using sqlmetal

hiI am using sqlmetal to generate code.below is the line i am using for code generation.SqlMetal.exe  /server:localhost /database:abc /code:..\Entities\CoreEntities.Generated.cs /namespace:abc.DAL /Context:abcDataContext /pluralizeIts working perfect but tables association are also generated , which I dont want in my code.Its generating code for table associations as well.[Association(Name="FK_Profile_LogonInfo1", Storage="_EXPRESS", ThisKey="EXPRESSEDTOUSERID", OtherKey="ID", IsForeignKey=true)]I feel that they are not required in front end, so I dont want sqlmetal to generate code for table associations.Please guide me.thanksSuman

Namespace problem (code behind "using")

Hello! I downloaded sample code from http://www.asp.net/security/tutorials/validating-user-credentials-against-the-membership-user-store-cs and imported the file "Login.aspx" file into my existing project.  This file has in the code behind the following namespaces: view plaincopy to clipboardprint? using System;   using System.Data;   using System.Configuration;   using System.Collections;   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;   I added a new page (e.g. Login1.aspx) to my project and copied the above to the top of the code behind page (Login1.aspx.cs).  In the downloaded file from the tutorial (Login.aspx) there is this line of code:Membership.ValidateUser(UserName.Text, Password.Text)And at build everything is OK! But if I add excatly the same code in my newly created page (Login1.aspx.cs) I get the following error: Error 9 The type or namespace name 'ValidateUser' does not exist in the namespace 'Krik.Membership' (are you missing an assembly reference?) G:\Krik\Krik\Login.aspx.cs 27 28 Krik The type or namespace name 'Validat

SSRS 2005 to 2008R2 custom code migration issue


We have an SSRS 2005 report that we upgraded to 2008R2 with custom code in the report properties code tab that no longer works.  We checked permission setting in the report server config files, checked if the data set was passig nulls and it is not, looked to see if we ignored the error if the report would render the correct value anyway despite the error and it did not, tried different code variations and referencing different system libraries without luck....we are truly baffled.  The only thing that does work is setting the total to 0 and removing the loop through the jsColl to compute the total.  Here is the code that used to work on 2005.  Any ideas why it does not work on 2008R2?  We call it in an expression =Code.getTotal()



jsColl As Microsoft.VisualBasic.Collection


Issue with designer files not updating -- and therefore cannot code



I have a problem in which some nested controls on a page are not updated in the designer file. I have deleted the designer file, selected Convert to Web Application, but still the controls are missing.

I know there is a supposed fix at http://blogs.msdn.com/b/webdevtools/archive/2010/03/05/hotfix-for-issue-with-auto-generated-designer-files-not-adding-controls.aspx

Unfortunately the patch won't install and I still have the issue.

Any thoughts? I am running VS 2010 Version 10.0.30319.1 RTMRel.



Odd issue with createuserwizard--can't see controls I add to template in code behind in .net 4.0


I was able to customize the createuserwizard in .net 3.5 with no problems.  I could add controls like the dropdownlist for city and state.  In the code behind, I was able to reference these controls by name, such as ddlstate.  However, I'm creating a new site from the ground up in .net 4.0 and was trying to edit the website that visual web developer 2010 creates when you create a new web site.  I went to the register.aspx page and added the city and state dropdowns.  In the code behind, I can't reference them as ddlstate anymore.  I even tried setting the clientidmode to static at the page level since I know the control names get mangled but that didn't help either.  However, the project builds fine as long as I don't attempt to reference the dropdownlist by name in the code behind. 

I'm also using jquery that I pulled from a working .net 3.5 site I had that gets errors when trying to reference the dropdownlist by name in .net 4.0.  The error says "ddlstate" is not a member of "asp.account_register_aspx".  The dropdownlist is set to runat server so I'm really confused why both my jquery and code behind can't seem to see the control in the createuserwizard control.  If I move the dropdownlist outside of the createuserwizard, it can see it and use it just fine.  A

Reference to a non-shared member requires an object reference in code generated by ASP.NET



I am working on converting a project from C# to VB and am facing this weird issue. 1 page cannot compile and I get the reference error, but the weird thing is that the compiler shows the error as coming from ASP.NET generated code. Visual Studio shows me that error is coming from my ASPX page. I cannot seem to figure out why or where this error is occuring. Also if I take the inherits attribute out I don't get the compilation error. The code in aspx page is below:

<%@ Page Language="VB" AutoEventWireup="true" CodeBehind="diff.view.aspx.vb"  Inherits="MR.ControlApp.diffview" MasterPageFile="~/Site1.Master"%>

<asp:Content ID="Header1" ContentPlaceHolderID="head" runat="server">

    Page: <select onchange="sel(this);">
        Dim j As Integer = 0
        While j < pageCount
           <option <%= IIf(currentPage = ( j + 1 ), "selected", "")  %> value="<%= j+1 %>"><%= j + 1 %></option>
        <%j = j + 1
        End While
    <% 'Print(); %>
    <div style="font-family: verdana; font-size: 10pt; font-weight: bold">
        MDM Data Inconsiste

Is the executable file generated by compiler a Managed code or Unmanaged code ?



when we compile our vb.net or c#.net code (say in a simple console application) then in bin\Debug folder a .exe file is created.Is that a managed code? when i directly execute this file,will this target CLR ? or will it directly run on OS ?

Why there is ConsoleApplication1.vshost.exe.manifest files created in that folder ?

What is .pdb file ?

That executable file is also created in obj\Debug folder .Why ?

Code in Content Editoe Web Part - Issue


I added the following code in content editor web part.

<!-- Code to hide Tab Page Help Link -->

<script type="text/javascript">

 $(document).ready(function() {




<!-- Code to add Tabs -->

<div id="tabs">

  <ul class="tabNavigation ms-WPBody">

   <li><a href="#tab-1" class="selected ms-topnavselected"><span>TAB 1</span></a></li>

   <li><a href="#tab-2" ><span>TAB 2</span></a></li>

   <li><a href="#tab-3" ><span>TAB 3</span></a></li>

   <li><a href="#tab-4" ><span>TAB 4</span></a></li>


  <div style="clear: both"></div>


After few edits to the page, when I try to edit the code in the content editor web part, the code appeared as follows. Not sure why these jquery ids got appended everywhere. Any suggestion as a solution for this issue ?

<!-- Code to hide Tab Page Help Link --><script type="text/javascript">

 $(document).ready(function() {



<!-- Code to add Tabs --><div id="tabs"><ul cla

VS2010 - Problem with WinForms generated code



I'm having trouble with the code that is generated automatically by the WinForms designer, sometimes it generates code that uses the 'components' (IContainer) in the constructors of disposable components and other times it doesn't.

Here is some code. First the code that is generated in a clean new project with just one component on the form:

  private void InitializeComponent()
   this.components = new System.ComponentModel.Container();
   this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components);
   // errorProvider1
   this.errorProvider1.ContainerControl = this;
   // Form1

Issue with Code Access Security Policy - deploying a third party dll to bin


Okay, i think most of you guys out there use wspbuilder to build the wsp solutions and to deploy it. So here is my problem.

I'm working on a SharePoint solution which makes use of a third party dll (Telerik for Asp.Net Ajax - Telerik.Web.UI.dll) for rich experience. Since Telerik dll is a common assembly i have to deploy it to the bin folder of the webapplication instead of GAC. So here comes the problem.

WSPBuilder automatically deploys the dll to gac if the dll presents in the GAC folder. To deploy the telerik dll in bin i created the folder 80\bin and copied the dll there. I tried to build the wsp again and then went through the manifest.xml created. Great. The deployment target for the dll changed to WebApplication and wspbuilder was smart to create the cas policy itself.

			<PermissionSet class="NamedPermissionSet

C# reading Java/Php/SOAP service, WSDL generated file missing some namespace information

I'm trying to use a Web Service, which I believe is Java/php/SOAP, using C#.
I can connect and send fine, but the results, which are an array of information,
is null. The return is not instant, and I can get back errors.
I believe the problem is in the WSDL translation. The actual response coming back
does not line up with the WSDL generated code in reguards to namespaces. In
perticular, 'getCategoryTreeResponse' & 'getCategoryTreeResult' do not show up 
in the generated file.
I'm quite sure the WSDL file provided is poorly written but I have no control
over it. WSDL.exe only works when I pass a saved copy of the web service's
provided WSDL information due to the way it is called.
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