Manually creating virtual directory while deploying WCF service. - asp.net

I have WCF service folder let's say : "TestService" and it contains following folders and files under TestServide folder:
TestService folder contains:
1.bin (folder)
2.Config (folder)
3.TestService.svc (file)
4.WebConfig (file)
when I go to InetMgr and try browsing the TestService.svc file, the wcf service opens successully:
path:
https://localhost/TestService/TestService.svc
question
I cut and paste two files ( TestService.svc and WebConfig ) under bin folder. Now the folder heirachy changes as follows:
TestService folder contains:
1.bin (folder) contains
a).TestService.svc (file)
b).WebConfig (file)
2.Config (folder)
Now again I go under bin folder and open TestService.svc to open iexplorer it does not opens and gives following error.
path:https://localhost/TestService/bin/TestService.svc
error:page cannot be found
Technical Information (for support personnel)
Background:
You have attempted to execute a CGI, ISAPI, or other executable program from a directory that does not allow programs to be executed.
More information:
Do I need to change anything so that my svc file will work??

If your web.config and TestService.svc are now in TestService/bin, you'll need to create an IIS web application pointing to that location.
You cannot have an IIS web application (virtual directory) pointing to "TestService" and then have your web.config and TestService.svc in a subdirectory of that IIS web app.
The IIS web app must point to the physical path where to web.config is located, and the *.svc files must be there in that same directory (not a subdirectory!), too.
Marc

Related

Publish profile copy file to remote directory outside of destination root VS2019

I'm trying to accomplish what seems like a simple task but having issues with the publish profile (pubxml) syntax to make this work
I'm using a web publish profile to push changes to our remote staging server, and I'm trying to include a global config file that's shared across our apps into a remote directory on that staging server into a folder that is 'outside' of the publish destination root folder.
Here's a basic sample folder layout of the source and destination:
Source file:
C:\dev\webapp1\Global.config
This is just a basic web config file in the project root.
The destination folders for our web apps would be:
C:\websites\Config
C:\websites\App1
C:\websites\App2
C:\websites\App3
App1 is the project with the publish profile I'm working with, so when I publish it needs to place the Global.config file into the websites\Config directory on the remote server.
So far I have:
<ItemGroup>
<ResolvedFileToPublish Include="Global.config">
<RelativePath>../Config/Global.config</RelativePath>
</ResolvedFileToPublish>
</ItemGroup>
I was hoping using the ../Config would back up a directory from the destination root and place the file in the remote server Config folder but it's placing it into the destination root folder (App1) instead.
Anyone know if this is possible?

Read file from a directory outside of Web project

my web application project (JBoss AS) needs to read a file which resides outside of this project. For example, the file to be read is under /tmp/.
It looks like classes in the project can't access files under /tmp/. However, it can output to a file in /tmp/.
Is this normal? How to access /tmp/ directory in a Web application?
Use java.io.tmpdir system property.
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
//Use tmpDir to access files in tmp directory
Make sure there are unix permissions to read/write contents on tmp directory.

How to change asp .net web service application build path instead of bin folder?

I am working asp.net web service application.
Normally running time my application dll taken from bin directory.
now i want to add some XML file and folder,so i want to change web service build directory.
I changed directory like this [ex:bin\Common],but this kind of issue came.
Parser Error
Parser Error Message:** Could not create type 'WebService.MainLogic'.
Source Error:
Line 1: <%# WebService Language="C#" CodeBehind="MainLogic.asmx.cs" Class="WebService.MainLogic" %>
Source File: /MainLogic.asmx Line: 1
How can I change the directory?
you can copy bin folder to specific folder after build project.
Right Click on project and go to properties => Build Events
in Post-build event command line write below command :
xcopy /Q /Y "$(TargetPath)" "C:\path\to\somewhere\"
for more information see this link : Copy bin files on to Physical file location on Post Build event in VS2010

Nested Virtual Directory Deleted on msdeploy

The project I have uses msdeploy to publish a package to IIS. It deploys over an existing version of the project. within the web application, I have a virtual directory, but every time I deploy the project, the virtual directory disappears.
I am calling MSDepoly in the following manner:
-source:package='d:\[...]\9.1.0.67\application\AppName.zip' -dest:auto,computerName="hostSite.com",userName="AutoInstall",password="****",authtype="NTLM",includeAcls="False" -verb:sync -enableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"d:\...\9.1.0.67\application\AppName.SetParameters.xml" -skip:objectName=binding -skip:absolutePath="info$" -skip:objectName=dirPath,absolutePath="help$",skipAction=Delete
as you can see at the end, I have the following skip rules:
-skip:objectName=binding -skip:absolutePath="info$" -skip:objectName=dirPath,absolutePath="help$",skipAction=Delete
The binding skip rule is working, but the virtual directory, info, is still getting removed from the web application. the virtual directory is nested within the help directory, so I added the skip action to skip deleting that folder as well.
I based all of this information from the following blog article, but my virtual directory, info, is still getting removed on deployment.
Please help!
I encountered the same issue. In development it appears the following skip rule prevented the Virtual Directory from being removed by MSDeploy.
-skip:ObjectName=virtualDirectory,absolutePath=.*NameOfVirtualDirectory
I gave up on getting msdeploy to play nice. I just wrote a bat script that would be executed after msdeploy completed:
mkdir C:\inetpub\application_wwwroot\VirtualDirectoryPhysicalDir
ECHO adding read permissions to the app pool
cacls C:\inetpub\application_wwwroot\VirtualDirectoryPhysicalDir/t /e /g "IIS APPPOOL\MyAppPool":r
ECHO creating "info" virtual directory
C:\Windows\System32\inetsrv\appcmd add vdir /app.name:"WebApplication/AppVirtualDirectory" / /path:"/help/info" /physicalPath:"C:\inetpub\application_wwwroot\VirtualDirectoryPhysicalDir"
C:\Windows\System32\inetsrv\appcmd set vdir /vdir.name:"Medrio/MedrioWeb/help/info" /physicalPath:"C:\inetpub\application_wwwroot\VirtualDirectoryPhysicalDir"

How to change the config file location of a virtual directory?

I need to publish my web application like below
1.root application(http://test.smt.com)
2.virtual directory(http://test.smt.com/console)
my root application contains virtual dir
Root
Folder 1(with 1.config)
Folder 2(with 2.config)
Folder 3(with 3.config)
Folder 4(with 4.config) // I've created this directory as virtual dir
root.config
Now the issue i'm getting is "Parser error"
I know that Root application access root.config also the virtual dir access 4.config
can we change the virtual directory to access its root.config only not 4.config?
finally i found a soln
need not to create a separate virtual dir in IIS.
I just entered http://test.smt.com/Folder4 (Folder 4 which is named as console dir)
it works for me... i'm happy....

Resources