Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api-docs is not generated #190

Open
mustafatig opened this issue Jan 31, 2019 · 6 comments
Open

api-docs is not generated #190

mustafatig opened this issue Jan 31, 2019 · 6 comments

Comments

@mustafatig
Copy link

mustafatig commented Jan 31, 2019

i have configured as doc but it is not working. What is my wrong? Could you please help me? i did not fix it. You can access ticket from here.

@justin0522
Copy link
Contributor

check Step 5 and Step 6
then visit http://localhost/RegistrationService/api-docs/swagger.json
if you get json string, go to visit http://localhost/RegistrationService/api-docs/index.html

@mustafatig
Copy link
Author

mustafatig commented Feb 4, 2019

i checked. everything is the same with doc. when i visit, it redirects me this url.
http://localhost/DummyProject/api-docs/index.html?url=/DummyProject/api-docs/swagger.json

protected void Application_Start(object sender, EventArgs e) { RouteTable.Routes.Add(new ServiceRoute("api-docs", new WebServiceHostFactory(), typeof(SwaggerWcfEndpoint))); }

Web Config is
<configuration> <configSections> <section name="swaggerwcf" type="SwaggerWcf.Configuration.SwaggerWcfSection, SwaggerWcf" /> </configSections> <swaggerwcf> <tags> <tag name="LowPerformance" visible="false" /> </tags> <settings> <setting name="InfoDescription" value="Sample Service to test SwaggerWCF" /> <setting name="InfoVersion" value="0.0.1" /> <setting name="InfoTermsOfService" value="Terms of Service" /> <setting name="InfoTitle" value="SampleService" /> <setting name="InfoContactName" value="Abel Silva" /> <setting name="InfoContactUrl" value="http://github.com/abelsilva" /> <setting name="InfoContactEmail" value="[email protected]" /> <setting name="InfoLicenseUrl" value="https://github.com/abelsilva/SwaggerWCF/blob/master/LICENSE" /> <setting name="InfoLicenseName" value="Apache License" /> </settings> </swaggerwcf> <system.webServer> <directoryBrowse enabled="true"/> <modules runAllManagedModulesForAllRequests="true"/> </system.webServer> <system.web> <compilation debug="true" targetFramework="4.6.1"/> <httpRuntime targetFramework="4.6.1"/> </system.web> <system.serviceModel> <services> <service name="SwaggerWcf.SwaggerWcfEndpoint"> <endpoint address="" binding="webHttpBinding" contract="SwaggerWcf.ISwaggerWcfEndpoint"></endpoint> </service> </services> <behaviors> <serviceBehaviors> <behavior name=""> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> </behavior> </serviceBehaviors> </behaviors> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" /> </system.serviceModel> </configuration>

Interface:

` [ServiceContract]
public interface IDummyService
{

    [SwaggerWcfPath("Get Dummy", "Retrieve all dummy from the store")]
    [WebInvoke(UriTemplate = "/getdata",
    BodyStyle = WebMessageBodyStyle.Bare,
    Method = "POST",
    RequestFormat = WebMessageFormat.Json,
    ResponseFormat = WebMessageFormat.Json)]
    [OperationContract]
    void GetData();
}`

Service:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] [SwaggerWcf("/v1/rest")] public class DummyService : IDummyService { [SwaggerWcfTag("GetData")] [SwaggerWcfResponse(HttpStatusCode.Created, "Data created, value in the response body with id updated")] [SwaggerWcfResponse(HttpStatusCode.BadRequest, "Bad request", true)] [SwaggerWcfResponse(HttpStatusCode.InternalServerError, "Internal error (can be forced using ERROR_500 as book title)", true)] public void GetData() { } }

@justin0522
Copy link
Contributor

justin0522 commented Feb 13, 2019

i create a project with your code,
https://github.com/justin0522/swaggerwcf190
it works for me

@mustafatig
Copy link
Author

It is not same as my code. Could you please fix on this project? https://github.com/mustafatig/SwaggerWCFSample

@justin0522
Copy link
Contributor

i created a pull request to your project

@gethari
Copy link

gethari commented Mar 9, 2021

i create a project with your code,
https://github.com/justin0522/swaggerwcf190
it works for me

Hi I'm getting 400 Bad Request in fiddler when I navigate to the api-docs URL on my project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants