i have developed a web servcies in my local system with name (inbox service).
when i did add web reference
i got like this in my web service descpition file
<?xml version="1.0" encoding="utf-8"?>
<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
<contractRef ref="http://localhost:1518/popup-message/InboxService.asmx?wsdl" docRef="http://localhost:1518/popup-message/InboxService.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap address="http://localhost:1518/popup-message/InboxService.asmx" xmlns:q1="http://tempuri.org/" binding="q1:InboxServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<soap address="http://localhost:1518/popup-message/InboxService.asmx" xmlns:q2="http://tempuri.org/" binding="q2:InboxServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>
but when i deploy my application (project) on server. i have my project url like this
ex: http://abc.com,
now my webservice is like this http://localhost:1518/popup-message/InboxService.asmx.
if i tied to call method from my page it is not working what is issue here
anyhelp would be great.
thank you
Have you edited the url in web.config / app.config? Note that if the web-reference is in a dll (not the web layer itself) you might not even see the setting in web.config; in such cases, copy the setting from the dll's config in VS - into web.config. Note that dll configs don't really do anything, except provide somewhere to copy/paste that value from.
Related
I created a Service Fabric application with a normal stateless service and a stateless ASP.NET Core web application. Without changing any of the default code I tried to deploy the application. During deployment an error occured:
Register-ServiceFabricApplicationType : The BuildLayout of the application in
C:\SfDevCluster\Data\ImageBuilderProxy\AppType\AadMockApplicationType is invalid. Code is missing for service
TenantWebServerPkg.
After inspecting my package I noticed that the package did not include the code but only the service manifest file and the configuration package:
My web application service manifest:
<?xml version="1.0" encoding="utf-8"?>
<ServiceManifest Name="TenantWebServerPkg"
Version="1.0.0"
xmlns="http://schemas.microsoft.com/2011/01/fabric"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ServiceTypes>
<!-- This is the name of your ServiceType.
This name must match the string used in RegisterServiceType call in Program.cs. -->
<StatelessServiceType ServiceTypeName="TenantWebServerType" />
</ServiceTypes>
<!-- Code package is your service executable. -->
<CodePackage Name="Code" Version="1.0.0">
<EntryPoint>
<ExeHost>
<Program>TenantWebServer.exe</Program>
<WorkingFolder>CodePackage</WorkingFolder>
</ExeHost>
</EntryPoint>
</CodePackage>
<!-- Config package is the contents of the Config directoy under PackageRoot that contains an
independently-updateable and versioned set of custom configuration settings for your service. -->
<ConfigPackage Name="Config" Version="1.0.0" />
<Resources>
<Endpoints>
<!-- This endpoint is used by the communication listener to obtain the port on which to
listen. Please note that if your service is partitioned, this port is shared with
replicas of different partitions that are placed in your code. -->
<Endpoint Protocol="http" Name="ServiceEndpoint" Type="Input" Port="8396" />
</Endpoints>
</Resources>
</ServiceManifest>
After trying for many hours I noticed that the code package is published to a different folder: C:\Users\username\AppData\Local\Temp\PublishTemp\TenantWebServer118
How do I package the web application correctly so the code package is included?
Note:
The .NET Core tools for Visual Studio 2015 are no longer being updated, however if you are still using Visual Studio 2015, you need to have .NET Core VS 2015 Tooling Preview 2 installed.
As stated in Microsoft docs:
To develop ASP.NET Core Service Fabric applications, you should have the following workloads installed:
Azure development (under Web & Cloud)
ASP.NET and web development (under Web & Cloud)
.NET Core cross-platform development (under Other Toolsets)
Updated:
Question: Why the code package is published to a different folder?
Answer: Example (Powershell) Register an application type
PS C:\> Copy-ServiceFabricApplicationPackage -ApplicationPackagePath "c:\work\PersistentToDoListService" -ImageStoreConnectionString "file:C:\SfDevCluster\Data\ImageStoreShare" -ApplicationPackagePathInImageStore "PersistentToDoListService"
PS C:\> Register-ServiceFabricApplicationType -ApplicationPathInImageStore "PersistentToDoListService"
Copy-ServiceFabricApplicationPackage copies the application package found in the "c:\work\PersistentToDoListService" folder to the image store. The package is copied at the relative path "PersistentToDoListService" in image store.
Register-ServiceFabricApplicationType command registers the application type found in the relative path "PersistentToDoListService".
I have this dilemma of having to have different connection strings for the web.config on my local machine and to have a release transformation that would make the production binaries use the machine.config on the web server.
So I have these files in my Visual Studio solution:
Web.Config
Web.Debug.Config
Web.Release.Config
In the web.config I have removed and added new connection strings.
<remove name="connstring">
<add name="connstring" ConnectionString="blahblah" />
What I want to do is to have nothing in final web.config when deployed (by TFS build) to the web server so that my web application would use anything in the machine.config on the server.
How can I do that?
You can remove configuration settings with the RemoveAll transform attribute. Assuming you are deploying the Release build configuration, you can generate a completely empty web.config by putting the following in Web.Release.Config:
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xdt:Transform="RemoveAll" />
This resulting web.config will have the XML declaration at the top and nothing else.
If you only want to remove certain configuration sub-sections, add the RemoveAll transform attribute to the section you want removed. For example, the following Web.Release.Config will remove all application settings:
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<appSettings xdt:Transform="RemoveAll" />
</configuration>
See the full Transformation Syntax Documentation for more details.
My app.config.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
</configSections>
<Something SettingsLocation="D:\test\test\file.json" />
<Something />
</configuration>
I need to update SettingsLocation programatically.
I found this some answers, but it is not clear to me.
Thanks fo help.
Each application has it’s own configuration file, be it a windows based application or web based.
This application configuration file defines information which can be used by application to make decisions, to load some other information or may contain the custom configuration which can be empowered to do anything.
There can also be scenarios where an application may want to change\modify the existing setting in the application configuration file and those changes should not only take effect immediately but should also be persisted.
Possible solution is already shown here
So I have made a web service in Visual Studio 2010. To deploy it onto the IIS web server, I copy the service.asmx, web.config, and the bin over to the server (wwwroot folder). This all works fine.
My problem is reading even a simple string from web.config. My code is:
In a method, I have:
string from = System.Configuration.ConfigurationManager.AppSettings["folder_new"];
In the web.config file, I have:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="folder_new" value="C:\images\new" />
</appSettings>
<...other stuff etc...>
</configuration>
I read in from the location "from". If I change it to
string from = #"C:\images\new";
it works perfectly.
This is driving me crazy.
You should be using the WebConfigurationManager class instead of the ConfigurationManager. The interface on it is basically the same.
string notFrom =
System.Web.Configuration.WebConfigurationManager.AppSettings["folder_new"];
have you tried double \'s in the config? Like "c:\\images\\new"
ConfigurationManager is for dealing with app config files for assemblies, rather than for Web.config files. Please use WebConfigurationManager instead.
I have an assembly with few versions registered in the GAC. Now, I want one of my clients which uses this assembly (version 1.3) to point to the newest version (1.4) without opening the source and recompiling the client.
I saw an article demonstrating a technique for doing so using the application config file (winform application)
here is the config file content :
<?xml version="1.0" encoding="utf-8" ?>
<configuration xmlns:asm="urn:schemas-microsoft-com:asm.v1">
<runtime>
<asm:assemblyBinding>
<!-- one dependentAssembly per unique assembly name -->
<asm:dependentAssembly>
<asm:assemblyIdentity
name="MyFacade"
publicKeyToken="c9c18e16df1654e0" />
<!-- one bindingRedirect per redirection -->
<asm:bindingRedirect oldVersion="1.3.0.0"
newVersion="1.4.0.0" />
</asm:dependentAssembly>
</asm:assemblyBinding>
</runtime>
</configuration>
As you can see, there is a binding redirect from version 1.3.0.0 to 1.4.0.0 for assembly named MyFacade.
Now, there's only a Minor issue with this approach. It doesn't work :)
I'm sure it's something with my code.
Any suggestions?
Thanks,
Adi Barda
first, this is the best source I've found about this subject. There are some differences, for example, they are not using the asm: namespace, and also, you might want to disable the publisher policy by adding <publisherPolicy apply="no" /> as described in the article.
In a previous project we did, we needed even more control, so we needed to catch the AppDomain.AssemblyResolve Event and route to any assembly we wanted. Here you can find more informations about the concept. You'd have to manipulate your app once, though.