Menu
  • HOME
  • TAGS

WCF service architecture query

Tag: asp.net,architecture,wcfserviceclient

I have an application that consists of a web application, and mutliple windows services, only one windows service is installed depending on what version of the backend sofware is used.

Currently, Data is saved by the web app in a database, then the relevant service is installed and this picks up the data and posts it in to the backend system that is installed.

I want to change this to use WCF services so the resulting data is returned directly to the web app.

I have not used WCF services before but Im assuming I can do something like this.

WebApp.Objects.Dll - contains Database objects, eg PurchaseOrder object

WebApp.Service.Contracts.dll - here I can describe the service methods, this will reference the WebApp.Objects.dll so I can take a PurchaseOrder object as a parameter

WebApp.Service.2011.dll - This will be the actual service for the 2011 version of the backend system, this will reference the WebApp.Service.Contracts dll

WebApp.Service.2012.dll - This will be the actual service for the 2012 version of the backend system, this will reference the WebApp.Service.Contracts dll

So, my question is, does the web app need to know the specifics about what backend WCF service is used? I just want to call a service with the specified Interface and not care about how its implemented or what it does internally, but just to return the purchase order that was created in the backend system (whether it return an interface or a concrete class)

Will i be able to create a service client without needing to know whether its the 2011, or 2012 WCF service being used?

Best How To :

As long as you are able to use the exact same contract for all the versions the web application does not need to know which version of the WCF service it is accessing.

In the configuration of the web application, you specify the URL and the contract. However, besides the contract there might be other differences between the services. In an extreme example this might mean that v2011 uses a different binding as v2012 of the backend - which is not very likely from your description. But also subtle differences in the configuration or the behavior of the services should be addressed in the configuration files. E.g. if v2012 needs longer for an action as v2011 does, the timeouts need to be configured so that the longer time of v2012 does not lead to an expiration.

Third-party security providers like Google, Twitter etc. in ASP.Net

asp.net,authentication

No, you cannot enter any string. You will need to register with each provider to get the parameters that you need. See http://www.asp.net/web-api/overview/security/external-authentication-services for instructions on how to do this....

How to make a website work only with https [duplicate]

asp.net,ssl,https

Sure, assuming you are using IIS to host your site, open IIS Manager and select your web site and then binding on the right: make sure you only have a binding for https not for http. This way IIS will only send https traffic to that web site. Edit: What...

Asp.Net Identity find users not in role

asp.net,linq,entity-framework,asp.net-identity

In c# you can get all users that are not in a certain role like this: var role = context.Roles.SingleOrDefault(m => m.Name == "role"); var usersNotInRole = context.Users.Where(m => m.Roles.All(r => r.RoleId != role.Id)); ...

UpdatePanel AsyncPostbackTrigger not firing

asp.net,ajax,webforms,updatepanel

I have just tested your code and seems to be working with some test modifications: ASPX <asp:UpdatePanel ID="UP_Panel" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:DropDownList ID="ddlSwitch" runat="server" Width="250px" AutoPostback="true" OnSelectedIndexChanged="ddlSwitch_SelectedIndexChanged"> <asp:ListItem Value="continent" Text="Continent"></asp:ListItem> <asp:ListItem Value="region" Text="Region"></asp:ListItem> <asp:ListItem Value="country"...

SQL Server / C# : Filter for System.Date - results only entries at 00:00:00

c#,asp.net,sql-server,date,gridview-sorting

What happens if you change all of the filters to use 'LIKE': if (DropDownList1.SelectedValue.ToString().Equals("Start")) { FilterExpression = string.Format("Start LIKE '{0}%'", TextBox1.Text); } Then, you're not matching against an exact date (at midnight), but matching any date-times which start with that date. Update Or perhaps you could try this... if (DropDownList1.SelectedValue.ToString().Equals("Start"))...

Cant delete in database because of constraints

c#,sql,asp.net,oracle

Best way to do it is by using a stored proceed rather than a sql statement in C# code. You are getting error because the referenced records are still present in referenced table and are using cmd.ExecuteReader(); rather than cmd.ExecuteNonQuery();. So you need to delete records for DBS2_MOVIE WHERE MOVIE_ID...

System.net.http.formatting causing issues with Newtonsoft.json

c#,asp.net,asp.net-mvc,json.net

Does the assemblyBinding tag have proper xmlns schema? Check if the issue you are encountering is same as Assembly binding redirect does not work

Convert Double from String

asp.net,vb.net,visual-studio-2012,converter

The result isn't wrong, it only has lower precision than you expected. Floating point numbers have a limited precision by design, and you simply can't expect to get a result that is more precise than its limit. You can use a Decimal to get higher precision. In this case it...

Catch concurrency exception in EF6 to change message to be more user friendly

c#,asp.net,.net,entity-framework,entity-framework-6

You are executing an asynchronous method. This means that any exceptions will be thrown when you call await on the returned task or when you try to retrieve the results using await myTask; You never do so, which means that the exception is thrown and caught higher up your call...

Database object with different data

sql,asp.net,asp.net-mvc,database,entity-framework-6

Ideally what you want is a many-to-many relationship between your Shop and Product entities: public class Shop { public int ShopId {get; set;} public virtual ICollection<ShopProduct> ShopProducts {get; set;} } public class Product { public int ProductId {get; set;} public string Name {get; set;} public virtual ICollection<ShopProduct> ShopProducts {get; set;}...

ASP.NET httpHandlers & handlers

asp.net,asp.net-mvc

The system.webServer section in the Web.config file specifies settings for IIS 7.0 that are applied to the Web application. The system.WebServer is a child of the configuration section. For more information, see IIS 7.0: system.webServer Section Group (IIS Settings Schema). and <system.web> specifies the root element for the ASP.NET configuration...

Random Questions keep on repeating

c#,asp.net

Hi here the problem is with your random function. If you want to make sure one question will get repeated only after all the questions have shown atleast one. step 1: keep a array with length equal to the number of question. step 2: get a random question . step...

Creating a viewmodel on an existing project

c#,asp.net,asp.net-mvc

You are using a namespace, your full type name is Project.ViewModel.ViewModel (namespace is Project.ViewModel and class name is ViewModel) so use this using instead: @model Project.ViewModel.ViewModel ...

Multiple Posted Types asp.net 5 MVC 6 API

c#,asp.net,asp.net-mvc,asp.net-5,asp.net-mvc-6

The best way is to create a composite wrapper: public class Wrapper { public ModelA A { get; set; } public ModelB B { get; set; } } Put Wrapper in the parameter list and mark that [FromBody]. You can't use that attribute more than once because all of the...

asp.net background in 3 pieces to be stationary

html,css,asp.net

I would use a separate div and use fixed positioning on it. Example <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>Layout Example</title> <link rel="stylesheet" type="text/css" href="./Layout Example_files/style.css"> <style type="text/css"> .fixed-background{ background: url( "images/SoapBubbles.jpg" ) no-repeat fixed top center; position:fixed; z-index:-1; top:0; right:0; left:0; bottom:0; } </style> </head> <body> <div...

How do ASP.NET Web APIs work once built with MSBUILD?

c#,asp.net,msbuild

The WebApi is a web project and on compiling it creates a dll. It is not a class library or a nuget package to consume and use it. I have practically implemented this in a real world application and below are my thoughts for your understanding. Your question is Once...

C# Code design / Seperate classes for each TabControl

c#,oop,architecture,software-design,code-design

Place a UserControl on each tab.

Event on dynamically created checkbox asp.net

c#,jquery,asp.net,table,checkbox

you can try this code List<CheckBox> lstChckBox; protected void Page_Load(object sender, EventArgs e) { // you can create controls programaticaly or html page, doesnt important //only you should know controls ID and all controls share same checked event CheckBox chc1 = new CheckBox(); chc1.CheckedChanged += new EventHandler(chck_CheckedChanged); CheckBox chc2 =...

Problems With FOR XML AUTO

sql,asp.net,sql-server,subquery,sqlxml

Change XML PATH('') to XML PATH('tag')

CommandName = Insert in EditTemplate of ASP.NET ListView throws “Insert can only be called on an insert item”

c#,asp.net,listview

The error is self explanatory. Take a look at this: https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listview.insertitemtemplate(v=vs.110).aspx So you can do either of these things. Create an InsertItemplate and insert using the ItemInserted event of the listview Change the CommandName to CommandName="InsertData" and catch that event on the ItemCommand ...

Sending LIst via ajax to complex model

javascript,c#,asp.net,ajax

You don't need to JSON.stringify the recipients. "recipients": JSON.stringify("[{'firstname':'a','lastname':'b','email':'c','voucheramount':'d'}]") Remove JSON.stringify form here and it should work. var postData = { "workplaceGiverId": $(".wpgDropdownList").val(), "fromMemberId": $(".wpgFromMemberDropdownList").val(), "toMemberId": $(".wpgToMemberDropdownList").val(), "voucherExpiryDate": $("#expiryDatePicker").val(), "recipients": [{'firstname':'a','lastname':'b','email':'c','voucheramount':'d'}] }; ...

Select @field From table as parameter

asp.net,sql-server,parameter-passing

If doing it from codebehind works then you can do something like sdsOrderErrors.SelectCommand = string.Format("SELECT {0} AS fld FROM [a_table]", colName); (OR) Have a stored procedure to accept a parameter and perform a dynamic query to achieve the same like create procedure usp_testSelect(@colname varchar(30)) as begin declare @sql varchar(200); set...

Can I uniquely identify 2 check boxes so that I can add a different image to each?

html,css,asp.net,checkbox

Here is an example of what I meant: (Oh and, forgive the images please :) ) #field1,#field2{ display:none; } #field1 + label { padding:40px; padding-left:100px; background:url(http://www.clker.com/cliparts/M/F/B/9/z/O/nxt-checkbox-unchecked-md.png) no-repeat left center; background-size: 80px 80px; } #field1:checked + label { background:url(http://www.clker.com/cliparts/B/2/v/i/n/T/tick-check-box-md.png) no-repeat left center; background-size: 80px 80px; } #field2 + label { padding:40px;...

why does the compiler complain about missing ctor of WebSocketHandler?

asp.net

protected member is accessible by derived class instances and there's nothing special about it. Nothing special in the class itself, either @ WebSocketHandler.cs. It just mens you need to pass in a nullable type, it does not mean it can't get any arguments. int? maxIncomingMessageSize = 0; var socket =...

How to change the colour and style of MajorGrid of AxisY in ASP.net chart

c#,asp.net,charts

May be this post will help you to change color of grid but keep AXIS same Visual Studio 2010 Chart control - line color. For line style Chart1.ChartAreas[0].AxisY.MajorGrid.LineDashStyle = System.Web.UI.DataVisualization.Charting.ChartDashStyle.Dash; ...

Show/hide tinymce with radio buttons

c#,asp.net,asp.net-mvc,tinymce

Your missing an @symbol for the id attribute: Modify your script as well like this: ***EDIT some thing seems off about the radio buttons only one should be checked and they should have the same name ** you can use the # to denote and ID in Jquery by the...

Make uneven table layout

html,asp.net

You can solve this using the attribute colspan on the td tag: <table border = "1"> <tr> <td colspan="2"> Do you love peanuts? This is a very important question. </td> </tr> <tr> <td> Yes, I do. </td> <td> No, I don't. </td> </tr> </table> Check this link ...

.NET wep api won't accept %2E or . in api request uri

c#,jquery,asp.net,ajax,json

Have a look at this answer MVC4 project - cannot have dot in parameter value? Try changing the Web.Config file <system.web> <httpRuntime relaxedUrlToFileSystemMapping="true" /> </system.web> ...

Azure Mobile Services: migrate to non-Azure Windows Server

asp.net,azure,azure-mobile-services

It is entirely possible to move the .NET runtime - This is just an ASP.NET Web API site, and it can be hosted anywhere that you might run ASP.NET. However, some features such as the login functionality will not be available. For the Node.JS runtime, the actual process running the...

Access manager information from Active Directory

c#,asp.net,active-directory

try this: var loginName = @"loginNameOfInterestedUser"; var ldap = new DirectoryEntry("LDAP://domain.something.com"); var search = new DirectorySearcher(ldap) { Filter = "(&(objectCategory=person)(objectClass=user)(sAMAccountName=" + loginName + "))" }; var result = search.FindOne(); if (result == null) return; var fullQuery = result.Path; var user = new DirectoryEntry(fullQuery); DirectoryEntry manager; if (user.Properties.PropertyNames.OfType<string>().Contains("manager")) { var managerPath...

onSuccess and onFailure doesn't get fired

javascript,c#,asp.net,webmethod,pagemethods

You PageMethod is looking like this PageMethods.LoginUser(onSuccess, onFailure, email, pass); And when you call it, it looks like this PageMethods.LoginUser(email, pass); Your arguments should be in the same order as the method. PageMethods.LoginUser(email, pass, onSuccess, onFailure); ...

WCF service architecture query

asp.net,architecture,wcfserviceclient

As long as you are able to use the exact same contract for all the versions the web application does not need to know which version of the WCF service it is accessing. In the configuration of the web application, you specify the URL and the contract. However, besides the...

Gridview items not populating correctly

asp.net,vb.net

Try this vb code behind, then comment out my test Private Sub BindGrid() Dim dt_SQL_Results As New DataTable '' Commenting out to use test data as I have no access to your database 'Dim da As SqlClient.SqlDataAdapter 'Dim strSQL2 As String 'Dim Response As String = "" 'strSQL2 = "SELECT...

How IE setting affect authorization

asp.net,iis

If you set "Enable Integrated Windows Authentication" (which is the default), and the server requires integrated Windows authentication, then the user will be authenticated silently using current default credentials, if possible. If you disable Integrated Windows Authentication, the user will be prompted to supply credentials. See this KB article for...

Trigger a js function with parameter from code behind

c#,jquery,asp.net,scriptmanager,registerstartupscript

All you need to do is add a semi-colon to the end of your String.Format call. ScriptManager.RegisterStartupScript(this, this.GetType(), "ScriptManager1", String.Format(@"ShowHideMessageBlock('{0}');", @"#successMsg"), true); ...

add BR between text in dynamically created control

c#,asp.net

You need to use InnerHtml property HtmlGenericControl li = new HtmlGenericControl("li"); li.ID = "liQuestions" + recordcount.ToString(); li.Attributes.Add("role", "Presentation"); ULRouting.Controls.Add(li); HtmlGenericControl anchor = new HtmlGenericControl("a"); li.Attributes.Add("myCustomIDAtribute", recordcount.ToString()); anchor.InnerHtml = "Test <br/> 12345"; li.Controls.Add(anchor); Or, like this: anchor.Controls.Add(new LiteralControl("Test")); //or new Literal("Test"); anchor.Controls.Add(new HtmlGenericControl("br"));...

Unable to find the auto created Database

c#,asp.net,asp.net-mvc,entity-framework

If you don't specify a database name then the connection will use the default database for the user, in this case it's integrated security so it's your Windows login. As you likely have full system admin on the server the default database will be master so you will find all...

Cannot start Website in IIS - W3SVC running

asp.net,iis

First verify that the World Wide Web Publishing Service is installed and not disabled. [Source:MSDN] Right-click My Computer on the desktop, and then click Manage. Expand the Services and Applications node, and then click the Services node. In the right pane, locate the World Wide Web Publishing Service. If the...

Callback on client does not get triggered with SignalR

javascript,c#,asp.net,signalr

It looks like you are missing client in: $hub.client.onRecieveNotification = function (message) { $("#message").append($("<li></li>", { text: message })); } ...

IIS 6 Allow anonymous access by default

asp.net,iis,website,iis-6

The solution is to force IIS to write the changes from the cache into the Metabase.xml, this way the new configurations will be available for editing. This is done using the command - %systemroot%\system32\IIsCnfg.vbs /save ...

deployment of a site asp.net and iis

c#,asp.net,iis

There are several domain providers like: godaddy, name etc you can use to buy a domain name. These providers also provide you steps to map the domain name to your website. Check out this link for example. This link explains domain name configuration in details.

Server side session in asp.net

asp.net,web-services,session

You've got a quotes problem, fix it like this: <% Session["path"] = "'" + vr_ + "'"; %> EDIT 1: Javascript and ASP.NET are not the same, so you cannot access the variables, so you can't do it on the client side. You must send something to the server like...

Why is my View not displaying value of ViewBag?

c#,asp.net,asp.net-mvc,asp.net-mvc-4,razor

ViewBag is used when returning a view, not when redirecting to another action. Basically it doesn't persist across separate requests. Try using TempData instead: TempData["Tag"] = post.SelectedTag.ToString(); and in the view: <p><strong>Tag: @TempData["Tag"]</strong></p> ...

Retrieve data from one table and insert into another table

sql,asp.net,sql-server

INSERT INTO tbl2 ( Name ,parentId ) SELECT DISTINCT manager ,0 FROM tbl1 WHERE manager NOT IN ( SELECT employee FROM tbl1 ) INSERT INTO tbl2 SELECT DISTINCT employee ,0 FROM tbl1 UPDATE tbl2 SET parentid = parent.id FROM tbl2 INNER JOIN tbl1 ON tbl2.Name = tbl1.employee INNER JOIN tbl2...

check if file is image

c#,asp.net,asp.net-mvc

You can't do this: string.Contains(string array) Instead you have to rewrite that line of code to this: if (file == null || formats.Any(f => file.Contains(f))) And this can be shortened down to: if (file == null || formats.Any(file.Contains)) ...

ASP.net website is not working properly while configuring in Internet Information Services

c#,asp.net,oracle11g,iis-7

I haven't personally worked with an Oracle database, but from your stack trace I see the following error: Attempt to load Oracle client libraries threw BadImageFormatException. This problem will occur when running in 64 bit mode with the 32 bit Oracle client components installed. Take a look at this similar...

How to format label in ASP.net chart control

c#,asp.net,asp.net-mvc,c#-4.0,reporting-services

Use formatting: DateTime.Now.ToString("dddd, dd-MM-yy"); Output: Montag, 15-06-15 //Written day of week in your local culture. To edit the axis labeling, you can do it in your code-behind file: Chart1.ChartAreas[0].AxisX.LabelStyle.Format = "dddd, dd-MM-yy"; Or in your markup: <ChartAreas> <asp:ChartArea Name="ChartArea1"> <AxisX Title="Date" IsLabelAutoFit="True" TitleForeColor="#ff0000"> <LabelStyle Format="dddd, dd-MM-yy" /> <MajorGrid Enabled ="False"...

RequiredFieldValidator not working in my ASp site

c#,css,asp.net,twitter-bootstrap

You just miss a little thing i.e. to assign a Validation Group to your buttons and your RequiredFieldValidators. Your code should be: <div class="container"> <h2>Registration</h2> <p>Please fill out the forms to complete your registration.</p> <form role="form"> <div class="form-group"> <label for="username">Name:</label> <asp:TextBox runat="server" ID="UserName" CssClass="form-control" /> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"...

Difference between application and module pipelines in Nancy?

c#,asp.net,nancy

The module- and application pipelines are explained in detail in the wiki. It's basically hooks which are executed before and after route execution on a global (application pipelines) and per-module basis. Here's an example: If a route is resolved to a module called FooModule, the pipelines will be invoked as...