Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

In my Elements.xml file I have the following:

<UrlAction Url="~site/_layouts/test/page.aspx?ListId={ListId}&amp;ItemId={ItemId}&amp;ItemUrl={ItemUrl}"/>

When the ECB item is selected I get the following error.

The Web application at localhost:81/Shared Documents/Hello.docx could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.

When I goto to the url localhost:81/Shared Documents/Hello.docx the file is there. When I go to localhost:81/_layouts/test/page.aspx the page is there. I am a little confused how I can be getting this error when I am using the {name}.

Update

With more investigation it is my page.aspx that is causing the error.

var itemUrl = Request.QueryString["ItemUrl"];
var siteURL = "";
var inputPath = siteURL + itemUrl;

var job = new ConversionJob("Word Automation Services") { UserToken = Site.UserToken }; // This is the default name of the service application

// Set the settings
if (Site.SiteSubscription != null)
    job.SubscriptionId = Site.SiteSubscription.Id;
    job.Settings.OutputFormat = SaveFormat.PDF;
    job.Name = "Conversion from Convert Item Menu";

    //var pdf file
    var newFile = siteURL + itemUrl.Replace(".docx", ".pdf");
    // Add the file
    job.AddFile(inputPath, newFile);

It is failing on the job.AddFile line.

inputpath = http://localhost:81/Shared Documents/Hello.docx

newFile = http://localhost:81/Shared Documents/Hello.pdf

The error is

System.IO.FileNotFoundException: The Web application at http://localhost:81/Shared Documents/Hello.docx could not be found. Verify that you have typed the URL correctly. If the URL should be serving existing content, the system administrator may need to add a new request URL mapping to the intended application.
   at Microsoft.SharePoint.SPSite..ctor(SPFarm farm, Uri requestUri, Boolean contextSite, SPUserToken userToken)

If I browse to localhost:81/Shared Documents/Hello.doc the file is there.

Update 2

If i change the port to 80 in iis for the site it then begins to work. I initially set up SP on port 80 but then changed it to port 81 in iis.

share|improve this question

3 Answers 3

My 2 cents would be to put Fiddler in between. Probably your request to webserver is not valid for whatever reason. If you put Fiddler as a proxy in between you can see what URL was requested and why the webserver felt it was a non valid request.

Fiddler can be downloaded from: http://www.fiddler2.com/fiddler2/

share|improve this answer

Actually, I don't think the question is related to UrlAction element. The main problem here is a Web application non-existance, mentioned in the error message:

The Web application at http://localhost:81/Shared Documents/Hello.docx could not be found.

You can use alternate access mappings to configure your server to run on another port. Add an IIS binding is not enough to achieve this.

Alternate access mappings (AAM) management page can be found in Central Administration site, under System Settings group:

AAM in Central Administration Menu

There, you should define a new mapping for port 81 for you existing web application.

They have video on technet on how to configure the AAM:

share|improve this answer

this is due to the fact that your request doesn't correctly decodes the url. The url most likely contains &amp; instead of only the & sign. This will result in the app not being able to get the correct param from the name value pairs.

Get the param : &amp;ItemUrl and it will work correctly. Check debugger to see the param list

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.