wcf metadata service page url - wcf

I have a service with the metadata exposed. Trouble is when I browse to the wsdl the service page it has the machine name as below:
MasterLibrary Service
You have created a service.
To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:
svcutil.exe http://mymachine/Master/Master.svc?wsdl
How do I make it show it as:
http://www.url.co.uk/Master/Master.svc?wsdl

You can query your current site bindings for the default web site as following:
cscript //nologo %systemdrive%\inetpub\adminscripts\adsutil.vbs get W3SVC/1/ServerBindings
Here is the command to change it:
cscript //nologo %systemdrive%\inetpub\adminscripts\adsutil.vbs set W3SVC/1/ServerBindings “:80:www.fancydomain.com”
You can also change it from IIS Manager UI. For HTTPS, the following command would work:
cscript //nologo %systemdrive%\inetpub\adminscripts\adsutil.vbs set W3SVC/1/SecureBindings “:443:www.fancydomain.com”
2) Recycle the AppDomain
Once you changed IIS settings, WCF does not automatically pick up the changes from IIS Metabase. You have to recycle the current AppDomain for the virtual application. There are a few different ways to do that:
· Change web.config file for the virtual application
· Kill w3wp.exe process
· Run “iisreset.exe”
3) Query the WSDL

If using iis7 in server 2008 just right click the service in iismanager select edit bindings if its http, then edit the http binding. In the hostname dialog box enter your custom hostname.
This link talks more about it metadataservice

Related

Using ChannelFactory with WorkflowServiceHost

Is there a way to do the service inference on a workflow definition XAML to create an interface that can be distributed to the client to be used with ChannelFactory instead of the host exposing WSDL and the client having to generate a service definition by adding a service reference?
I did this in a three step process:
Temporarily exposing the metadata from the workflow service
Creating proxy code with svcutil
Changing configuration back to not exposing metadata
In detail:
Include your XAMLX file which defines the service in a project that was created as "WCF Workflow Service Application" (DeclarativeServiceLibrary1)
Compile the project
Set the project as startup project
Select xamlx file in Solution Explorer
Press Ctrl-F5 -> WCF Test Client starts, you see your service loaded
RightClick on the xamlx URL in WCF Test Client, choose Copy address (e.g. http://localhost:56326/Service1.xamlx)
Open a VS2010 Admin console window
Create the proxy code with svcutil.exe:
cd /D %TEMP%
svcutil http://localhost:56326/Service1.xamlx
This creates two files, a *.cs and a *.config, that contain the proxy code
I had a lot of problems with other ways of craeting the proxy code (inside VS2010), the external svcutil was the most stable way to do it. Hope this helps.

Must use exact identifier for APP object with verb SET

I'm following this article on allowing WCF to read data from MSMQ but am getting an error with this command
appcmd set app "MSMQ/MsmqService" /enabledProtocols:net.msmq
MSMQ is the name of my IIS hosted website and MsmqService is the name of the .svc file.
The error I get is
ERROR ( message:Must use exact identifer for APP object with verb SET. )
Here is what my site looks like in IIS
I ran into this today, so here's the fix for the "Exact Identifier" error:
Change
"MSMQ/MsmqService"
To
"MSMQ/MsmqService/"
appcmd simply expects a path that includes a slash at the end (exact identifier).
#Sachin, All you are trying to perform by running this command is to set net.msmq in the enabled protocols of the virtual directory. In this specific command the MsmqService is the name of the vDir under your web site MSMQ. If you create a vDir with name MsmqService and execute this command the command will succeed (not the svc file name). And svc files should have the .svc extension for IIS to be able to invoke the appropriate handlers when a request arrives.
Alternatively you can do the same thing in IIS UI following these instructions:
inetmgr from run prompt
Go to the web site MSMQ
Navigate to the vDir MsmqService. Right click -> Manage application -> "Advanced settings..."
Notice a setting named "Enabled Protocols". Type in net.msmq there. Hit OK.

Silverlight 4 WCF Ria Services 404 Error

My Silverlight 4 WCF RIA Services Project works fine on my dev machine from VS 2010 also published, from IIS. But when I deploy it to the client machine (windows7) all my service methods return NotFound error. I tried all blog posts and forums all day long but in vain. service url from fiddler returns on the dev machine but 404 on the client pc. I am so frustrated right now. In my last trial I saw about manual creation of physical .svc file
<%# ServiceHost Service="Fully.Qualified.NameOfYourService" Factory="System.ServiceModel.DomainServices.Hosting.DomainServiceHostFactory" %>
But couldn't figure out how to implement, someone please save my future??
install .NET framework 4.0;
install IIS7 and enable "Windows Communication Foundation HTTP Activation" in the "Windows features";
install WCF RIA Services with the option "SERVER=true" (you could also skip this step setting "Copy Local=True" for the System.ServiceModel.DomainServices.* dlls stored in the bin folder of your web application);
msiexec /i RIAServices.msi SERVER=true
use the "Add Application" menu in "IIS Manager" specifying the application name, the deploy dir containing your app and "ASP.NET v4.0" as application pool;
if you obtain a "404 error" it's also useful to run "aspnet_regiis.exe -i" from the "C:\Windows\Microsoft.NET\Framework\v4.0.30319" directory;
simple, create a new web site [to host your application] and then run the "aspnet_regiis -i" from the framework folder [Framework for 32bit or Framework64 for 64bit applications].
When viewing the HTTP Handlers section under the new website and you will see the various mappings for the .svc files have been created [look back at the default website and these havent been upgraded!]. This then resolved the 404 errors and Fiddler was also confirming that the svc files were being accessed correctly.
As a last configuration make sure the application pool is set to the ASP.NET 4 Integrated mode pool and enable the allow 32bit applications.
Hope this helps :-)

WCF and IIS confusion on the wsdl location

I created my WCF project and it works fine when I just run it from the debugger.
But when I publish it to IIS and point a browser to the svc the path used has localhost in it. Like this:
htpp://localhost/MyService/MyServices.svc
but the path that the webpage says to go to for the WSDL uses my computer name, like this:
http://MyComputerName.MyDomain.net/MyService/MyService.svc?wsdl
When I click on the link it times out. (Also, trying to view the services like that in WCFTestClient times out.)
However, if I go the wsdl using localhost then it works right away:
http://lcoalhost/MyService/MyService.svc?wsdl
Any link that uses my computer name times out ("takes too long to respond").
Any idea on how to make my WCF service work with the computer name?
(NOTE: I am using Visual Studio Ultimate and IIS 7)
Try adding MyComputerName.MyDomain.net to your proxy bypass list in Internet Explorer proxy configuration setting. Check that the IIS website has this FQDN in it's hostname in the site bindings.
Also what happens if you only use MyComputerName without the domain ?

How can I consume a WCF service using a local WSDL file?

I need to consume a WCF service based on a (preferably single) wsdl file.
The environment is VS-2008 (sp1), and I will be using a customized "Add Service Reference" macro to generate an error handling proxy. I want to be able to do this, by supplying a WSDL file that I get from the service provider (I do not want to supply a host URL).
How can this be done?
Sure - you can copy the path+filename for the WSDL and paste that into the "Add Service Reference" dialog box in Visual Studio (or just type int the full path + WSDL file name).
Alternatively, you can use the svcutil.exe command line utility to convert the WSDL file to your client proxy class.