Must use exact identifier for APP object with verb SET - wcf

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.

Related

Reference.vb code debugging

When adding a reference to a web service, a Reference.vb file gets generated to make all the service's types available to the hosting project.
When I put a breakpoint in that file it never gets hit. How can I solve this?
If you're using VS2013 you can disable Just My Code in the debugging options.
https://msdn.microsoft.com/en-us/library/dn457346(v=vs.110).aspx
That will make VS ignore the DebuggerStepThroughAttribute that Stephan B mentions. If you're using older version of VS you can delete the attribute from the Reference.vb
See System.Diagnostics.DebuggerStepThroughAttribute for why it never gets hit. Right now I don't know how to tell the Debugger to halt anyway, ignoring the Attribute but you should be able to remove the Attribute from Reference.vb and start your Debug session without VS regenerating the file.
You can try the below steps;
Open the web service project and go to web services project's "My Project".
Go to Web tab.
Choose "Don't open a page. Wait for a request from an external application."
Choose "Use Local IIS Web Server"
Change Project URL: "http://localhost/YourWebService" to your service name.
Click on "Create Virtual Directory".
Set the breakpoint at desire location.
Debug Run the web services "F5".

HTTP Error 404.0 - Not Found when accesing SVC service

I have REST service application which is hosted in an IIS 8 in a Windows 8 PC. When I request the service I am getting an error as follows ... HTTP Error 404.0 - Not Found.
Here is the detailed error message.
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
Most likely causes:
•The directory or file specified does not exist on the Web server.
•The URL contains a typographical error.
•A custom filter or module, such as URLScan, restricts access to the file.
Things you can try:
•Create the content on the Web server.
•Review the browser URL.
•Create a tracing rule to track failed requests for this HTTP status code and see which module is calling SetStatus. For more information about creating a tracing rule for failed requests, click here.
Detailed Error Information:
Module IIS Web Core
Notification MapRequestHandler
Handler StaticFile
Error Code 0x80070002
Requested URL http://IP.com/Wining/RService.svc/general
Physical Path C:\inetpub\wwwroot\Wining\RService.svc\general
Logon Method Anonymous
Logon User Anonymous
Any help on this would be greatly appreciated.
There are myriads of possible causes. In general, the target resource at given URL is not found, so it may be simply missing, misconfigured, not started, etc. First - check the server logs, they usually contain more detailed information about the issue.
Also, please doublecheck that the service really is up and running. Connect to the www server and check it via localhost not ip.com.
I'm not an expert, but judging from the snippet you provided, it seems to be WCF service, the Handler: StaticFile seems very odd. It seems like the IIS misinterpretes your request as a StaticFile (a resource read from the disks and just passed-through without any further processing) which for me seems perfectly wrong.
You may have not installed the service properly, or have url mappings and/or handlers messed up, or you may even have NET/ASP framework not properly installed.. What have you installed first? .Net or IIS?
check similar questios, there are many.. for example:
WCF on IIS8; *.svc handler mapping doesn't work
HTTP 404 when accessing .svc file in IIS
I had to enable HTTP Activation in .NET Framework 4.5 Advanced Services > WCF Services (running on WIndows 2012) and after an IISReset it worked fine.

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 ?

wcf metadata service page url

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

Publishing my WCF Service to my webhotel provider

I have made a small log service that i want to publish to a subdomain on my webhotel. I make the wcf service and test it locally - no problem. I then go to the [Build] menu and choose [Publish], type in my FTP location and publishes it to the location. No problems.
The problem arise when i need to use it, i try to navigate to the .svc file but gets this error:
This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
Parameter name: item
What am I doing wrong?
That's because of your IIS configuration. This has already been discussed here: WCF service startup error "This collection already contains an address with scheme http"
Solved! The problem is that i cannot access the IIS configuration, since its on a hosted environment. The solution is described on my blog, since i had so much trouble getting this to work.
http://www.vikingworks.dk/post/WCF-Service-on-hosted-environment.aspx