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

Top 5 Contributors of the Month
Post New Web Links

rotating through endpoints

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :WPF
how can i make the user to rotate image through the endpoints of the image only if my code is: img.MouseLeftButtonDown += delegate { islbDown = true; startPosition = Mouse.GetPosition(img); img.CaptureMouse(); Point temp = new Point(ActualWidth / 2, ActualHeight / 2); centerPosition=img.TranslatePoint(temp,mycanvas); }; img.MouseMove += delegate { Point toPosition = new Point(); if (islbDown) { RotateTransform rt = (RotateTransform)img.LayoutTransform; rt.CenterX = img.ActualWidth / 2; rt.CenterY = img.ActualHeight / 2; toPosition = Mouse.GetPosition(img); Double delta = Vector.AngleBetween(startPosition - centerPosition, toPosition - centerPosition); rt.Angle += delta; img.RenderTransform = rt; } if (isrbDown) { toPosition = Mouse.GetPosition(mycanvas); Canvas.SetLeft(img, toPosition.X - startPosition.X); Canvas.SetTop(img, toPosition.Y - startPosition.Y); } }; thanks in advance!

View Complete Post

More Related Resource Links

wcf endpoints


Hi, I've wondered if I should change something in the endpoints while hosting my wcfs on IIS .

In my web.config I have a wcf:

<endpoint address="http://localhost:4205/ContactService.svc"
    binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IContactService"
    contract="ContactService.IContactService" name="WSHttpBinding_IContactService">
     <dns value="localhost" />

and I wondered if I should change something there.



Multiple net.tcp endpoints with different portnumbers on the same web site

I have multiple services that have to run under one website. Two of the services have a net.tcp endpoint. The addresses are formatted as follows: net.tcp://backend.ourcompany.com:9080/Product1/2010/09/Service1/Service1.svc net.tcp://backend.ourcompany.com:9081/Product1/2010/09/Service2/Service2.svc net.tcp://backend.ourcompany.com:9090/Product2/2010/09/Service2/Service2.svc Both services have their own Web.config. Currently both services have a different base address in their Web.config and a relative endpoint address. Everything worked ok with just the fist service installed, after installing the second I keep getting this error: 'This collection already contains an address with scheme net.tcp.  There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.' Since the multipleSiteBindingsEnabled is only for http (why?) I tried getting it to work with the baseAddressPrefixFilters but I don't really understand how that would help me in my case. Is it possible what I'm trying to do here? Otherwise this would be a big fail of IIS, in a self-hosted environment I'm doing the same thing for years. I now want to migrate my ex

Multiple endpoints in IIS

I am trying to setup my WCF service in IIS. I definately need to have the rest-ful service enabled using the webHttpBehavior and webHttp behavior. In addition, I want to keep the basicHttpBinding.   When I try this I get the following exception message:   A binding instance has already been associated to listen URI 'http://saslaptop/BE/Application.svc'. If two endpoints want to share the same ListenUri, they must also share the same binding object instance. The two conflicting endpoints were either specified in AddServiceEndpoint() calls, in a config file, or a combination of AddServiceEndpoint() and config.   Should this be possible?   Code Block <system.serviceModel> <behaviors> <endpointBehaviors> <behavior name="WebHttpBehavior"> <webHttp/> </behavior> </endpointBehaviors> </behaviors> <services> <service name="Application.Webservices.ApplicationService"> <endpoint behaviorConfiguration="WebHttpBehavior" binding="webHttpBinding" contract="Application.Webservices.IApplicationService"/> <endpoint binding="basicHttpBinding" contract="Application.Webservices.IApplicationService"/> </service> <service name="Application.Webservices.TypeAhead"> <endpoint behaviorConfiguration="WebHttpBehavior" bindin

Rotating Graphical path with mouse move



So, I have written a code to draw a graphical replica of human Hand with 'DrawPath' Class. The static graphic looks good, but I want to use it with mouse move so It can act like a human hand with the movement of cursor. The problem I am facing is that when I move my object with mouse move [as I have Hard coded the hand with its first finger basically representing the Mouse position and then drawing other points from it], the hand seem to loose its shape.


The problem occurs because when hand moves the orientation changes and the hard coded code just brings the points closer to each other or if I don't do that then orientation doesn't change [hand remains same as exactly upright]. Do anyone know which factor I should add with each points of my hand so it preserve it shape or better if there is any function which can control orientation automatically??


All help is much appreciated



Best practice for WCF service exposing multiple client-specific endpoints?


Moving forward with re-designing a web service architecture using WCF, our team has been discussing how we want to expose the endpoints. Example: I have a standard endpoint that all users could use with the proper token, but I also have some number of endpoints that will instead use certificate security. All endpoints will ultimately use the same implementation, so this is really just different ways of getting in to the system.

The certificate endpoints will have to point to a specific certificate in the store so will only work for one specific client. The thought is that our standard service could live at http://mysite.com/MyService.svc and the certificate endpoints would be something like http://mysite.com/MyService.svc/Acme. The concern here is that I'm effectively putting our client list into our WSDL, which is not desirable.

What's the best practice here? Is there a way to direct multiple clients through a single certificate endpoint and get the cert on the code side (how would we know which client we're dealing with without a sp

How to configure relative address for additional endpoints


I have 3 endpoints on my service (hosted in IIS):




service name<

Configuration for STS with multiple endpoints


Hello all

I'm trying to configure an STS to have 2 endpoints. First endpoint accepts username client credentials and the second accepts the issued token as client credentials. So my client uses username and password to get a token, and when the token is about to expire I want to renew the token

I'm able to use the first endpoint but the second fails with error: Cannot find a token authenticator for the 'System.IdentityModel.Tokens.SamlSecurityToken' token type. Tokens of that type cannot be accepted according to current security settings.

I've tried to add custom service credentials but the are never hooked up.  

Exposing service with multiple endpoints


I have a service hosted as Windows Service. Now I want to make the same service availble via basicHttpBinding, wsHttpBinding.
So, I modified the my app.config as below using Microsoft Configuration editor. The WCF Service is already running on server (as Windows Service)

Note: The code (config) inside comments (below) is actual and the code inside "<!-- Newly .." is added later using config editor.
<!-- ORIGINAL -->
<!-- END - ORIGINAL -->

1. What I need to have in "baseAddresses" section for newly added endpoints (basicHttpBinding, wsHttpBinding)
2. Is newly added configuration correct?
3. Other than adding basicHttpBinding and wsHttpBinding, is there anything else that I need to do on "server"?

<?xml version="1.0" encoding="utf-8"?>
        <!-- ORIGINAL -->
        <behavior name="FirstServiceBehavior">
          <serviceMetadata httpGetEnabled="false" />
          <serviceDebug includeExceptionDetailInFaults="true" />

Service XXX has zero application (non-infrastructure) endpoints?


I have read a lot of discussions about this type of problem in this forum already.
However, I still not be able to make it works when I try to  test the service on m localhost by typing:
http://localhost/StudentService/StudentService.svc and it throws back this error 

"Service 'Dq.Services.Student.StudentService' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element. "

On the post build event, I also copy
MyDll.dll to inetpub\wwwroot\StudentService\bin   
StudentService.svc to inetpub\wwwroot\StudentService\.
Please let me know what wrong with my codes.

App.Config file:

<?xml version="1.0" encoding="utf-8" ?>
      <service name="Dq.Services.Student.StudentService&qu

Service with both secured and unsecured endpoints?



I have a service that looks like this :

			<service behaviorConfiguration="AppClientService.CustomValidator_Behavior" name="App.ServiceImplementation.AppClientService">
    <endpoint binding="netTcpBinding" bindingConfiguration="netTcpRegular" behaviorConfiguration="AppClientService.AppClientService_Behavior" address="Regular" bindingNamespace="http://App.ServiceContracts/2007/11" contract="App.ServiceContracts.IAppClientService" />
				<endpoint binding="netTcpBinding" bindingConfiguration="netTcpUserNameMessageSecurity" address="UserName" bindingNamespace="http://App.ServiceContracts/2007/11" contract="App.ServiceContracts.IAppClientService" />
				<endpoint binding="netTcpBinding" bindingConfiguration="netTcpWindowMessageSecurity" address="Windows" bindingNamespace="http://App.ServiceContracts/2007/11" contract="App.ServiceContracts.IAppClientService" />
    <endpoint address="httpMex" binding="mexHttpBinding" contract="IMetadataExchange" />
				<endpoint address="tcpMex" binding="mexTcpBinding" contract="IMetadataExchange" />

Having issues with rotating large Image.Metafile


update:  this issue starts when the size of image drawn is 3000x3000 or more and rotated.  What happens to metafiles when they are rotated.  Do they lose their vector advanatages and require as much memory as a bitmap.   My suspicion is an out of memory error is occuring, but not being reported.


I have large Metafile (4000x4000 pixels), and need to provide ability to rotate and scale image.  I have external process (3rd party) that renders the image as an Image.Metafile.  I need to create a rotated version of this image and then paint int on a new graphics.   To do so, I am creating a new rotated metafile (see code below - RotateDimensions will rotate around origin).   Then I am painting this new image to the current graphics context, using Graphics.DrawImage(image, 0, 0).   I tried many different overloaded calls to DrawImage, but each time the following happens:

-  at 180 degrees, the image is always pixolated

-  at 90 and 270 degrees, the image disappears when it becomes large (due to zooming)

-  it is always fine at 0 degrees.

No errors are thrown.  Please help with advice.

Custom tool warning: No endpoints compatible with Silverlight 4 were found.


Warning 2 Custom tool warning: No endpoints compatible with Silverlight 4 were found. The generated client class will not be usable unless endpoint information is provided via the constructor.

I am getting following warning when I try to add reference of WCF service (dual binding) Custom tool warning: No endpoints compatible with Silverlight 4 were found. The generated client class will not be usable unless endpoint information is provided via the constructor. Does silverlight not supporting binding other than basicHttp?? if yes, what are the other option for me? Please reply

Many Thanks Deepak

Reporting Services Authorization error depending on web endpoints



I have a solution that uploads reports to a reporting server (SQL 2008 R2)

For compatibility , I have two service apps which work completely the same way, but which use different web service endpoints:

App2005 uses http://localhost:8080/reportserver/reportservice2005.asmx

App2010 uses http://localhost:8080/reportserver/reportservice2010.asmx

Both Apps work fine on a test machine.

On my developer machine (local admin) App2005 works, but App2010 does not.

Error is "The request failed with HTTP status 401: Unauthorized."

The error raises at the ListChildren method, source snippet is here:


         oRes = New ReportService2010.ReportingService2010

         oRes.Credentials = System.Net.CredentialCache.DefaultCredentials

         oRes.Url = String.Format("{0}/ReportService2010.asmx", oArgs.ReportServerUrl)


         oItems = oRes.ListChildren(oArgs.FolderSearch, False)

Any hint here ?

I upgraded from SQL Server 2008 to R2, VS2008 and VS2010 installed on WinXPSP3

WCF Rotating message log file

The project I'm working on connects to a WCF service intensively. All communication must be logged to disk.
The whole message needs to be logged. I use standard WCF message logging for this and write it to a file: web_messages.svclog. This works OK.

I use a sharedlistener like:
<add initializeData="Logs/web_messages.svclog"
    type="System.Diagnostics.XmlWriterTraceListener, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
    <filter type="" />

The problem is I want to rotate this logfile every day, for it will become very large after a couple of days and grow to its maximum size.
I tried using Enterprise Library Logging Block, however the XmlWriterTraceListener does not support rotating the log files. I also tried renaming the log file when the day has passed manually using code, however not suprisingly IIS locks the logfile so I cannot rename it.

Can anybody point me in the right direction? Or has implemented this him- or herself?

Rody van Sambeek

Bit shifting is rotating

Hi, I have a problem, my bit shifting is rotating

ulong uiData = 0x0000000001;
uiData <<= 66;

Answer is here 0x0000000001
But I would expect  0x000000000

How do I disable rotating
I am compiling on 64bit core.

best reg, Patrik

Patrik Nylund

Host.Description.Endpoints.Find doesn't work with localhost


endpoint = context.Host.Description.Endpoints.Find(context.incomingMessageheaders.To);

This doesn't work if the client is using LocalHost in url. In this case incomingMessageheader.To contains Localhost, where as the hosted endpoints is having

my machine name.



Discovery on IIS hosted WCF service no endpoints found untill site is visited


I have a problem which makes the whole discovery (.net 4) idea useless.
I got self-hosted wcf services with discovey working so I now at least something about it, however, when I create a website with a .svc file, configure the web.config well and host it in IIS something goes wrong.

I have my windows forms client program to test the discovery and it doesn't return any endpoints, not after iisreset, not after checking twice, tree-times with long timeouts. I have to manually "visit" my .svc file in the website by browser to kind of activate it and than my client recogizes it immediately.

Because you have to visit the service first, you already have to know what the url is and makes discovery pointless in this case (and I need it so much)

What can I do about this?

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